Commit cc7f166e by Иван Кубота

scss import error handling

parent b5e48fae
...@@ -118,6 +118,7 @@ var transformServe = function(dir, anything) { ...@@ -118,6 +118,7 @@ var transformServe = function(dir, anything) {
let fixedUrl; let fixedUrl;
let serve = function (req, res, next) { let serve = function (req, res, next) {
var qRes = res;
if (req.url in cache) { if (req.url in cache) {
return res.end(cache[req.url]) return res.end(cache[req.url])
} }
...@@ -162,8 +163,12 @@ var transformServe = function(dir, anything) { ...@@ -162,8 +163,12 @@ var transformServe = function(dir, anything) {
if(err){ if(err){
fs.readFile(fName = name+'.css', function(err, res) { fs.readFile(fName = name+'.css', function(err, res) {
if(err){ if(err){
done( false); var origEnd = qRes.end;
//throw new Error('what the fuck'); qRes.end = function(data) {
console.error(data);
origEnd.call(qRes, data)
};
done(new Error('Can not resolve dependency!'))
}else{ thisOne(fName, res+'') } }else{ thisOne(fName, res+'') }
}) })
}else{ thisOne(fName, res+'') } }else{ thisOne(fName, res+'') }
...@@ -329,11 +334,13 @@ var doUpdate = async function(){ ...@@ -329,11 +334,13 @@ var doUpdate = async function(){
var files = []; var files = [];
for( let filename in debounce ){ for( let filename in debounce ){
try{ try{
var code = await readFile( filename ) + ''; if(filename.substr(-4)==='.jsx'){
var url = '/'+path.relative( './src', filename ).replace(/\\/g, '/') var code = await readFile( filename ) + '';
console.log('Live transform jsx ',url) var url = '/' + path.relative( './src', filename ).replace( /\\/g, '/' )
var result = await transformJSXPromised( code, url ); console.log( 'Live transform jsx ', url )
files.push( { file: url, content: result.code } ); var result = await transformJSXPromised( code, url );
files.push( { file: url, content: result.code } );
}
}catch( e ){ }catch( e ){
console.log( 'Error in ' + e ); console.log( 'Error in ' + e );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment