1
當我在我的任務之一報錯了:如何在Gulp任務錯誤回調中顯示堆棧跟蹤?
gulp.task('foo', function(onDone) {
onDone('It did not work');
});
我獲得了大量不相關的堆棧跟蹤:
[13:10:25] 'foo' errored after 4.27 s
[13:10:25] Error: It did not work
at formatError (C:\npm\node_modules\gulp\bin\gulp.js:169:10)
at Gulp.<anonymous> (C:\npm\node_modules\gulp\bin\gulp.js:195:15)
at emitOne (events.js:96:13)
at Gulp.emit (events.js:188:7)
at Gulp.Orchestrator._emitTaskDone (D:\Code\my-project\node_modules\orchestrator\index.js:264:8)
at D:\Code\my-project\node_modules\orchestrator\index.js:275:23
at finish (D:\Code\my-project\node_modules\orchestrator\lib\runTask.js:21:8)
at cb (D:\Code\my-project\node_modules\orchestrator\lib\runTask.js:29:3)
at D:\Code\my-project\gulp-tasks\insert-docs.js:116:25
at Request._callback (D:\Code\my-project\gulpfile.js:112:17)
我怎麼不顯示?我傾向於使用內建gulp功能而不是第三方模塊或console.error()
。