probmods / webppl-editor

Browser-based editor for WebPPL
Other
8 stars 1 forks source link

Handle errors thrown as strings #20

Closed stuhlmueller closed 8 years ago

stuhlmueller commented 8 years ago

The editor shows a readable error message for code that calls this function:

window.foo = function() { throw new Error('foo') };

However, it doesn't show any message for code that calls this function:

window.bar = function() { throw 'bar' };

In various places in webppl (and probably also in its dependencies), errors are thrown as strings, so it's important to handle this case.

longouyang commented 8 years ago

Added in 95236b9

We should make every effort inside of webppl to throw proper errors, though, so that we keep stack information.