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

Remove extra exception wrapper allocation #321

Merged
merged 1 commit into from
Oct 19, 2022
Merged

Conversation

tenderlove
Copy link
Member

ActionDispatch::ExceptionWrapper.new(backtrace_cleaner, exception).exception

The above code just returns the original exception object. You can see in
Rails
the exception is simply stored in an ivar and then returned with an attr_reader. There shouldn't be any reason to construct this object

```ruby
ActionDispatch::ExceptionWrapper.new(backtrace_cleaner, exception).exception
```

The above code just returns the original exception object.  You can see
[in
Rails](https://github.com/rails/rails/blob/08ef43ed5e01b42b2aec847a0424515f537ed427/actionpack/lib/action_dispatch/middleware/exception_wrapper.rb#L44-L48)
the exception is simply stored in an ivar and then returned with an
attr_reader.  There shouldn't be any reason to construct this object
@gsamokovarov
Copy link
Collaborator

Thanks, will merge this, as I have unlocked the build.

@gsamokovarov gsamokovarov merged commit 891c363 into master Oct 19, 2022
@gsamokovarov gsamokovarov deleted the no-extra-wrapper branch January 9, 2023 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants