sgzwiz / brython

Automatically exported from code.google.com/p/brython
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Import error not properly catched #30

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In console (Firefox 17.0.1 / Linux ):
try:
    print(1)
    import not_exist
    print(2)
except:
    print(3)
print(4)

try:
    print(1)
    import not_exist
    print(2)
except ImportError:
    print(3)
print(4)

Output:
1
2
4
1
2
4
<done in 216 ms>

Expected:
1
3
4
1
3
4

Log shows:
ImportError: ImportError: No module named 'not_exist'
module '__main__' line 3
    import not_exist @ http://www.brython.info/py_utils.js:37

Original issue reported on code.google.com by pedro.ro...@gmail.com on 2 Jan 2013 at 9:35

GoogleCodeExporter commented 9 years ago
Fixed in revision 322
Exceptions thrown in Ajax callbacks can't be caught by the program sending it
cf. 
http://stackoverflow.com/questions/4573038/rethrowing-error-in-ajax-callback-fun
ction

Original comment by pierre.q...@gmail.com on 3 Jan 2013 at 9:31