I’d like to wrap my code in a custom type of Closure during build process with Grunt (and uglify). This manipulation must keep the sourceMap working.
My use case is to wrap all my code inside a try/catch block to allow logging of the errors in production – without losing access to the stacktrace (unlike window.onerror). I’d probably use Raven-js 1.0 to work this out.
Anyone know how I could manage this easily?
If you just have tips that might bring a full answer, that’ll be accepted too
Finally, I’ve found a grunt plugin (grunt-wrap) who does exactly this:
If you’re interested in
raven-js. I’ve been with thetry/catchoverRaven.contextas this won’t create a new global closure around the code.