diff options
author | Edward Casbon <edward@edwardcasbon.co.uk> | 2014-08-11 12:40:01 +0100 |
---|---|---|
committer | Richard van Velzen <rvanvelzen1@gmail.com> | 2015-02-11 23:21:22 +0100 |
commit | ae07714927f44790e40628cde4fa57bc2c4cb076 (patch) | |
tree | 36e462a353befbf26228fa7431ceb4ba434fab61 | |
parent | 0e41a3fad4f8cabbac568b55f2b8e460646b5860 (diff) | |
download | tracifyjs-ae07714927f44790e40628cde4fa57bc2c4cb076.tar.gz tracifyjs-ae07714927f44790e40628cde4fa57bc2c4cb076.zip |
Add filename to the JS_Parse_Error exception.
It would be nice to have access to the filename of the file that includes the code that causes a JavaScript error. This is especially handy if uglifying multiple files at once.
Only a small change is needed for this to happen as it's already available in the function that throws the error.
-rw-r--r-- | lib/parse.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/parse.js b/lib/parse.js index 78c1dd41..0e269ab7 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -187,8 +187,9 @@ function parse_js_number(num) { } }; -function JS_Parse_Error(message, line, col, pos) { +function JS_Parse_Error(message, filename, line, col, pos) { this.message = message; + this.filename = filename; this.line = line; this.col = col; this.pos = pos; @@ -200,7 +201,7 @@ JS_Parse_Error.prototype.toString = function() { }; function js_error(message, filename, line, col, pos) { - throw new JS_Parse_Error(message, line, col, pos); + throw new JS_Parse_Error(message, filename, line, col, pos); }; function is_token(token, type, val) { |