mapbox / mapbox-gl-rtl-text

Add right-to-left text support to Mapbox GL JS
Other
53 stars 20 forks source link

Don't re-throw uncaught exceptions while running in Node environment #1

Open ChrisLoer opened 7 years ago

ChrisLoer commented 7 years ago

When it's running in a Node environment, the Emscripten runtime will rethrow any uncaught exception:

process['on']('uncaughtException', function (ex) {
    if (!(ex instanceof ExitStatus)) {
        throw ex;
    }
});

Although it doesn't mess with the stack trace, it means that if a developer runs into an uncaught exception while running the GL JS test suite, the first thing they see is a somewhat misleading error message showing an error being thrown from mapbox-gl-rtl-text.

This is part of a class of changes where the most straightforward place to make a change is in the Emscripten compiler, but I'd prefer not to start maintaining an Emscripten port. This is a simple enough case that I could maybe just take it out with a sed build step.

/cc @anandthakker @lbud