Repository navigation
Swap additional context and label in I/O errors - #14954
Merged
Merged
Conversation
132ikl
marked this pull request as ready for review
January 29, 2025 01:46
cptpiepmatz
reviewed
Jan 29, 2025
Comment on lines
+330
to
+336
| impl std::error::Error for AdditionalContext {} | ||
|
|
||
| impl From<String> for AdditionalContext { | ||
| fn from(value: String) -> Self { | ||
| AdditionalContext(value) | ||
| } | ||
| } |
Member
There was a problem hiding this comment.
If you derive the struct with thiserror::Error as I stated, you can remove this entirely.
Suggested change
| impl std::error::Error for AdditionalContext {} | |
| impl From<String> for AdditionalContext { | |
| fn from(value: String) -> Self { | |
| AdditionalContext(value) | |
| } | |
| } |
Comment on lines
+393
to
+396
| match &self.additional_context { | ||
| Some(ctx) => Some(ctx as &dyn Diagnostic), | ||
| None => None, | ||
| } |
Member
There was a problem hiding this comment.
At this point, you don't need to match anymore
Suggested change
| match &self.additional_context { | |
| Some(ctx) => Some(ctx as &dyn Diagnostic), | |
| None => None, | |
| } | |
| self.additional_context.as_ref().map(|ctx| ctx as &dyn Diagnostic) |
Member
Author
There was a problem hiding this comment.
I knew there was a way to do this with map, I must've missed as_ref. Thanks! Resolved by 1954a29
Member
Author
|
@cptpiepmatz should be good now, let me know what you think. you seemed on the fence about this, so if you're not sure I can hold off and get some extra opinions from core team, otherwise I can merge before the release |
cptpiepmatz
approved these changes
Feb 3, 2025
Member
|
I know again why I initially disliked this. I had it set up similar to this before I had the |
Contributor
|
Thanks |
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.
Description
Tweaks the error style for I/O errors introduced #14927. Moves the additional context to below the text that says "I/O error", and always shows the error kind in the label.
User-Facing Changes
N/A, as this is a follow-up to #14927 which has not been included in a release
Tests + Formatting
N/A
After Submitting
N/A