Permalink
Browse files

js2c: raise proper Exception, not a string

Fixes the following error message:

  TypeError: exceptions must be old-style classes or derived
  from BaseException, not str

Fixes #4303.
  • Loading branch information...
1 parent 335f208 commit aa3441ae45b348aa2e1b422d1c5a69b49e909a95 @bnoordhuis bnoordhuis committed Nov 24, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 tools/js2c.py
View
2 tools/js2c.py
@@ -206,7 +206,7 @@ def ReadMacros(lines):
fun = eval("lambda " + ",".join(args) + ': ' + body)
macros[name] = PythonMacro(args, fun)
else:
- raise ("Illegal line: " + line)
+ raise Exception("Illegal line: " + line)
return (constants, macros)

2 comments on commit aa3441a

@ackalker

Thanks @bnoordhuis for the patch, please note that this bug and more like it are also in deps/v8/tools/js2c.py, so these should probably be sent upstream, too.

$ git grep raise -- '**/js2c.py'
deps/v8/tools/js2c.py:    raise ("Eval disallowed in natives: %s" % file)
deps/v8/tools/js2c.py:    raise ("With statements disallowed in natives: %s" % file)
deps/v8/tools/js2c.py:          raise ("Illegal line: " + line)
tools/js2c.py:          raise Exception("Illegal line: " + line)
@alFReD-NSH

@ackalker Those are in v8, and should be fixed on v8. Better create an issue v8 issue tracker.

Please sign in to comment.