-
-
Notifications
You must be signed in to change notification settings - Fork 197
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
Avoid swallowing errors in case of AttachmentType Serialization failure #1953
Avoid swallowing errors in case of AttachmentType Serialization failure #1953
Conversation
Signed-off-by: TheSilkMiner <[email protected]>
|
src/main/java/net/neoforged/neoforge/attachment/AttachmentType.java
Outdated
Show resolved
Hide resolved
Signed-off-by: TheSilkMiner <[email protected]>
@neoforged/bots backport 1.21.1 |
Backporting to |
🚀 This PR has been released as NeoForge version |
@Technici4n backport to 1.21.1 failed. Click for failure reason{"message":"Invalid request.\n\nNo subschema in "anyOf" matched.\nFor 'anyOf/0', {"labels" => []} is not an array.\nFor 'anyOf/1', {"labels" => []} is not an array.\n1 item required; only 0 were supplied.","documentation_url":"https://docs.github.com/rest/issues/labels#add-labels-to-an-issue","status":"422"} |
Given that this TODO has been here since the inception of the system, and that I've seen quite a few errors get swallowed, I figured it was time to tackle this.
The change itself is trivial, but going through
DataResult#getOrThrow
rather than first obtaining theOptional
and then unconditionally unwrapping it gives us access to the error message that signals the issue within the codec, so the developer has a better idea of what's going on.It would be better if we were to somehow also be able to print the ID or some other kind of identifying info to specifically indicate which attachment is exploding, but that does not seem to be possible with the system as it is currently designed. For this reason, I decided to leave that temporarily as a further TODO for discussion.