2016-03-26 6 views
0

私のGulpタスクの1つが失敗すると、このようなコンソールにエラーが表示されます。失敗したGulpタスクでコールスタックを削除するには?

PhantomJS 2.1.1 (Linux 0.0.0): Executed 12 of 12 (1 FAILED) (0.355 secs/0.43 secs) 
[20:18:42] 'client-test' errored after 15 s 
[20:18:42] Error: Karma exited with status code 1 
    at /home/blacksonic/workspace/angular2-webpack-es6-starter/tasks/client_test.js:15:21 
    at removeAllListeners (/home/blacksonic/workspace/angular2-webpack-es6-starter/node_modules/karma/lib/server.js:336:7) 
    at Server.<anonymous> (/home/blacksonic/workspace/angular2-webpack-es6-starter/node_modules/karma/lib/server.js:347:9) 
    at Server.g (events.js:260:16) 
    at emitNone (events.js:72:20) 
    at Server.emit (events.js:166:7) 
    at emitCloseNT (net.js:1519:8) 
    at nextTickCallbackWith1Arg (node.js:431:9) 
    at process._tickCallback (node.js:353:17) 

この長い呼び出しスタックを削除してエラーメッセージを表示する方法はありますか?

答えて

0

Gulpの組み込みエラーイベントをパイプで使用してください。

var $ = require('gulp-load-plugins'); 

gulp.src(file.path) 
      .pipe('-- Your script --') 
      .on('error', function(){ 
        $.util.log('Hey! something broke'); 
       }) 
      .pipe('-- Your other script --') 
      .pipe(gulp.dest('-- You know the drill --')) 

gulp.src(file.path) 
     .pipe('-- Your script --') 
     .on('error', function(){ 
       // Log a smaller version of the error 
       // or do nothing. Whatever you want 
      }) 
     .pipe('-- Your other script --') 
     .pipe(gulp.dest('-- You know the drill --')) 

あなたは、このようなに上記のコードを向けるだろうgulp-util

からロガーとして素敵なロガーを自分で装備する必要があります