mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
Fix CLI crash when null
is thrown
Before: ``` $ ./bin/coffee -e 'throw null' /src/coffee-script/lib/coffee-script/command.js:251 message = err.stack || ("" + err); ^ TypeError: Cannot read property 'stack' of null at compileScript ... ``` After: ``` $ ./bin/coffee -e 'throw null' null ``` Supersedes and closes #4135.
This commit is contained in:
parent
ec9c4d8594
commit
0e0e8f87e1
2 changed files with 2 additions and 2 deletions
|
@ -248,7 +248,7 @@
|
|||
if (CoffeeScript.listeners('failure').length) {
|
||||
return;
|
||||
}
|
||||
message = err.stack || ("" + err);
|
||||
message = (err != null ? err.stack : void 0) || ("" + err);
|
||||
if (o.watch) {
|
||||
return printLine(message + '\x07');
|
||||
} else {
|
||||
|
|
|
@ -198,7 +198,7 @@ compileScript = (file, input, base = null) ->
|
|||
catch err
|
||||
CoffeeScript.emit 'failure', err, task
|
||||
return if CoffeeScript.listeners('failure').length
|
||||
message = err.stack or "#{err}"
|
||||
message = err?.stack or "#{err}"
|
||||
if o.watch
|
||||
printLine message + '\x07'
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue