Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce IRB.conf[:backtrace_filter] for upstream projects to extend filter_backtrace #914

Closed
joshbroughton opened this issue Mar 26, 2024 · 0 comments · Fixed by #917
Closed
Assignees

Comments

@joshbroughton
Copy link
Contributor

Description

If upstream projects (like Rails) want to extend or alter the behaviour of filter_backtrace, they currently have to override the filter_backtrace method (like Rails does here). Directly overriding a method of the internal WorkSpace component is not a great way to extend a behaviour. Instead, we could add a config that creates a more proper way for upstream projects to extend the filter.

A better way to do this would be to:

Introduce IRB.conf[:backtrace_filter] that’s invoked after filter_backtrace is called.
Ideally, IRB.conf[:backtrace_filter] = Rails.backtrace_cleaner should fully replace the current handle_exception patch. But we’ll see if that’s possible when we have a PR
The above means that IRB’d expect the value of backtrace_filter to implement a filter(array_of_backtrace) method

Thanks for the suggestion on how to approach this @st0012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants