diff --git a/lib/coffee-script/coffee-script.js b/lib/coffee-script/coffee-script.js index 18133b34..28b855fc 100644 --- a/lib/coffee-script/coffee-script.js +++ b/lib/coffee-script/coffee-script.js @@ -34,6 +34,9 @@ return fn.call(this, code, options); } catch (_error) { err = _error; + if (typeof code !== 'string') { + throw err; + } throw helpers.updateSyntaxError(err, code, options.filename); } }; diff --git a/src/coffee-script.coffee b/src/coffee-script.coffee index 7e6f76c4..c2b81a39 100644 --- a/src/coffee-script.coffee +++ b/src/coffee-script.coffee @@ -26,6 +26,7 @@ withPrettyErrors = (fn) -> try fn.call @, code, options catch err + throw err if typeof code isnt 'string' # Support `CoffeeScript.nodes(tokens)`. throw helpers.updateSyntaxError err, code, options.filename # Compile CoffeeScript code to JavaScript, using the Coffee/Jison compiler.