Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adhere to --stack even when logging fatal

  • Loading branch information...
commit dd95f05f547d5697072d66b4a840b6c75686abd6 1 parent 3ebb2a7
@Almad Almad authored
Showing with 13 additions and 8 deletions.
  1. +13 −8 lib/grunt/fail.js
View
21 lib/grunt/fail.js
@@ -39,9 +39,21 @@ function writeln(e, mode) {
grunt.log.writeln([tags[mode][0], msg.yellow, tags[mode][1]].join(' '));
}
+// If --stack is enabled, log the appropriate error stack (if it exists).
+function printStack(e) {
+ if (grunt.option('stack')) {
+ if (e.origError && e.origError.stack) {
+ console.log(e.origError.stack);
+ } else if (e.stack) {
+ console.log(e.stack);
+ }
+ }
+}
+
// A fatal error occured. Abort immediately.
fail.fatal = function(e, errcode) {
writeln(e, 'fatal');
+ printStack(e);
process.exit(typeof errcode === 'number' ? errcode : 1);
};
@@ -63,14 +75,7 @@ fail.warn = function(e, errcode) {
if (fail.warnAlternate) {
fail.warnAlternate();
} else {
- // If --stack is enabled, log the appropriate error stack (if it exists).
- if (grunt.option('stack')) {
- if (e.origError && e.origError.stack) {
- console.log(e.origError.stack);
- } else if (e.stack) {
- console.log(e.stack);
- }
- }
+ printStack(e)
// Log and exit.
grunt.log.writeln().fail('Aborted due to warnings.');
process.exit(typeof errcode === 'number' ? errcode : 2);
Please sign in to comment.
Something went wrong with that request. Please try again.