Track type name on error before losing that info#213
Merged
jbr merged 2 commits intohttp-rs:mainfrom Aug 12, 2020
Merged
Conversation
Member
Author
|
(I'm thinking the dev-mode-error-handler is something I probably could/should extract, once it's polished up. Not sure if it should live in tide or as an external crate, since it's somewhat opinionated, but assumedly opt-in) |
Fishrock123
approved these changes
Aug 5, 2020
Open
yoshuawuyts
previously requested changes
Aug 7, 2020
Member
yoshuawuyts
left a comment
There was a problem hiding this comment.
std::any::type_name returns an &'static str; this means we can inline it in the struct without performing any new allocations. This doesn't mean that tracking the type name is free; but it should at least save some of the cost.
If we can change that this PR should be good to merge!
keep the type_name a &'static str Co-authored-by: Yoshua Wuyts <yoshuawuyts+github@gmail.com>
7821e22 to
2c6e3f1
Compare
Made the suggested changes, Error holds a &'static str now
Member
|
This looks merge-able? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If this turns out to have meaningful performance implications, we could feature flag this or just do it conditionally when debug_assertions are on.
This combines well with #212 to allow for this sort of development-mode error handler in tide:
