Error when calling logError callback on error
See original GitHub issueThis is a simple task to compile sass to css with sourcemaps:
gulp.task('sass', function () {
gulp.src(['*.scss'])
.pipe(sourcemaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('dist'));
});
I’m getting this error if there is a syntax error on sass file:
/Users/lm/Sites/app/node_modules/gulp-sass/index.js:170
this.emit('end');
^
TypeError: undefined is not a function
at Function.logError (/Users/lm/Sites/app/node_modules/gulp-sass/index.js:170:8)
at DestroyableTransform.<anonymous> (/Users/lm/Sites/app/gulpfile.js:109:16)
at DestroyableTransform.emit (events.js:129:20)
at onwriteError (/Users/lm/Sites/app/node_modules/gulp-sass/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:345:10)
at onwrite (/Users/lm/Sites/app/node_modules/gulp-sass/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:363:5)
at WritableState.onwrite (/Users/lm/Sites/app/node_modules/gulp-sass/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:123:5)
at afterTransform (/Users/lm/Sites/app/node_modules/gulp-sass/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:84:5)
at TransformState.afterTransform (/Users/lm/Sites/app/node_modules/gulp-sass/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:59:12)
at errorM (/Users/lm/Sites/app/node_modules/gulp-sass/index.js:123:14)
at Object.callback (/Users/lm/Sites/app/node_modules/gulp-sass/index.js:134:18)
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:7
Top Results From Across the Web
How To Handle Errors in Asynchronous Javascript Code ...
The first argument of the callback is usually named error, whereby if something goes wrong in the asynchronous function, then the callback gets...
Read more >Cannot verify calls to ILogger in .NET Core 3.0 Preview 8 ...
In .NET Core 2.2, I am able to use Moq to test calls made to an ILogger. ... I'm trying to setup a...
Read more >Error handling with promises - The Modern JavaScript Tutorial
Promise chains are great at error handling. When a promise rejects, the control jumps to the closest rejection handler.
Read more >Catching Errors thrown by callback functions - Stack Overflow
This first function works well by throwing the error. I am trying to get the second function to do the same. async facebook(req,...
Read more >Handle errors in ASP.NET Core Blazor apps - Microsoft Learn
Discover how ASP.NET Core Blazor manages unhandled exceptions and how to develop apps that detect and handle errors.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I wanted to write a ‘beep’ to the console by creating my own error callback. The trick is to manually bind the
logError
function:The syntax is a bit ridiculous, but it works!
Closing as stale. There appear to be work arounds.