[Pkg-javascript-commits] [uglifyjs] 51/77: Add filename to the JS_Parse_Error exception.

Jonas Smedegaard dr at jones.dk
Tue May 19 00:02:32 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag v2.4.18
in repository uglifyjs.

commit ae07714927f44790e40628cde4fa57bc2c4cb076
Author: Edward Casbon <edward at edwardcasbon.co.uk>
Date:   Mon Aug 11 12:40:01 2014 +0100

    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.
---
 lib/parse.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/parse.js b/lib/parse.js
index 78c1dd4..0e269ab 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) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/uglifyjs.git



More information about the Pkg-javascript-commits mailing list