Hooking in to the Global Error Handler

This is a repost from a slack comment that I made.

How would one go about hooking into the global error handler? If I wanted to post an error to an external service (such as sentry), is there an event I can intercept or a handler I can override/hook into?

just wondering where & at what point I would do that

Great question :slight_smile:

You can create a global error hook by creating a service at /services/errors/ErrorHandler.cfc with a raiseError() method in an extension or in your application.

We have a sentry extension, for example, that does exactly this: GitHub - pixl8/preside-ext-sentry: Sentry error reporting for the Preside platform

Its worth noting I thiknk that this service will not be instantiated using wirebox. This means that any dependencies on other cfcs will need to be instantiated manually. The reason for this is to ensure that the error handling continues to run when there are errors instantiating the Coldbox system, etc.