How do I make Browsersync+gulp-Sass not jump out of Gulp when there is a compilation error?

  node.js, question
var gulp        = require('gulp');
 var browserSync = require('browser-sync').create();
 var sass        = require('gulp-sass');
 var reload      = browserSync.reload;
 
 gulp.task('serve', ['sass'], function() {
 
 browserSync.init({
 server: "./"
 });
 
 gulp.watch("sass/*.scss", ['sass']);
 gulp.watch("./*.html").on('change', reload);
 });
 
 gulp.task('sass', function() {
 return gulp.src("sass/*.scss")
 .pipe(sass())
 .pipe(gulp.dest("css"))
 .pipe(reload({stream: true}));
 });
 
 gulp.task('default', ['serve']);

This is the code for gulpfile.js
I used BrowserSync to listen to the. html file and the. scss file in sass. once the. scss file is modified, it is compiled to generate the. css file, and then the page is refreshed automatically. the modified. html will also be refreshed. However, the problem arises. If my code in. scss is wrong, there will be an error when compiling, and then I will jump out of gulp directly. What can I do to prevent it from jumping out, or to print out the error information without jumping out and compile it?

Found the answer, add a pipeline in sass.

//Compile asynchronously, and stop compiling into css if compilation error occurs, that is, skip the next operation and reload directly
 .pipe(sass().on('error', sass.logError))

Done!