Skip to content

Commit e4addd1

Browse files
committed
feat(hooks): add err handler for hooks
1 parent 8327da5 commit e4addd1

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

lib/models/Project.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,11 @@ var Project = function () {
485485
}
486486
};
487487
}), function (err) {
488+
if (err) {
489+
logError(err);
490+
process.exit(1);
491+
}
492+
488493
var statsInfo = stats.toJson({ errorDetails: false });
489494

490495
if (statsInfo.warnings.length > 0) {
@@ -546,6 +551,10 @@ var Project = function () {
546551
}
547552
};
548553
})), function (err) {
554+
if (err) {
555+
logError(err);
556+
process.exit(1);
557+
}
549558
compilerProcess();
550559
});
551560

src/models/Project.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,12 @@ class Project {
490490
}
491491
};
492492
}),
493-
err => {
493+
(err) => {
494+
if(err) {
495+
logError(err);
496+
process.exit(1);
497+
}
498+
494499
let statsInfo = stats.toJson({ errorDetails: false });
495500

496501
if (statsInfo.warnings.length > 0) {
@@ -551,7 +556,7 @@ class Project {
551556
// 支持异步调用
552557
let isAsync = false;
553558
beforePackItem.bind({
554-
async: function(){
559+
async: function() {
555560
isAsync = true;
556561
return callback;
557562
}
@@ -562,7 +567,11 @@ class Project {
562567
}
563568
};
564569
})),
565-
err => {
570+
(err) => {
571+
if(err) {
572+
logError(err);
573+
process.exit(1);
574+
}
566575
compilerProcess();
567576
}
568577
);

0 commit comments

Comments
 (0)