Closed smaant closed 7 years ago
~ I think maybe being able to pass middleware to wrap the standard rollbar-reporting fn would be neater. It'd be odd to have a rollbar library you can configure to not send to rollbar.
@gordonsyme why not? You may want to do it for some environments, for example.
The code in 9df9ff7 doesn't allow you to intercept all events that are being sent to Rollcage, just the ones from the uncaught exception handler - this seems strange to me.
What's use-case here? Is the aim to log uncaught exceptions from an app? If yes, then why not just install an uncaught exception handler in the app that logs (and build a chain like here).
Otherwise, it might make sense to add a callback/middleware type function to the client that is called before any event is sent to Rollcage.
@marcomorain well, other events are generated by my code, so under my control by definition. My particular use case to also log exceptions and be able to don't send anything from tests. I don't really see how callbacks/middleware is simpler or better than just passing a function.
Custom reporting function will allow having more control over uncaught exceptions. For instance, log them.