Skip to content

Commit

Permalink
Port fix for bare except from amo-validator
Browse files Browse the repository at this point in the history
  • Loading branch information
mattbasta committed Oct 23, 2013
1 parent 2fb8dcc commit eb97eac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion appvalidator/testcases/javascript/call_definitions.py
Expand Up @@ -88,7 +88,7 @@ def wrap(wrapper, arguments, traverser):
# ", ".join(map(str, params)))
try:
return JSLiteral(func(*params), traverser=traverser)
except:
except (ValueError, TypeError, OverflowError):
# If we cannot compute output, just return nothing.
return JSLiteral(None, traverser=traverser)

Expand Down
9 changes: 9 additions & 0 deletions tests/js/test_operators.py
Expand Up @@ -227,3 +227,12 @@ def test_simple_operators_when_dirty(self):
""" +
"""y += y + x;""" * 100) # This bit makes the validator's head explode.

def test_wrapped_python_exceptions(self):
"""
Test that OverflowErrors in traversal don't crash the validation
process.
"""

self.run_script("""
var x = Math.exp(-4*1000000*-0.0641515994108);
""")

0 comments on commit eb97eac

Please sign in to comment.