Is it possible to change the stacktrace before printing the exception?

Is is possible to create a global filter which can change every exceptions’ stacktraces before they gets printed?

I know that I can write __STACKTRACE__ and change the stacktrace in any way I like, but this requires adding try/rescue to every raising function.

Is there any other way to change the stacktrace of unhandled exceptions just before they get printed to the user?

1 Like


If this is about preventing secrets from leaking, then it doesn’t seem like there’s a global way of doing that:

If this is about adding additional information then this might be intersting:

1 Like

This is just about rewriting the stacktrace modules