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

Avoid swallowing errors in case of AttachmentType Serialization failure #1953

Open
wants to merge 2 commits into
base: 1.21.x
Choose a base branch
from

Conversation

TheSilkMiner
Copy link
Member

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 the Optional 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.

Signed-off-by: TheSilkMiner <thesilkminer@outlook.com>
@neoforged-automation neoforged-automation bot added the 1.21.4 Targeted at Minecraft 1.21.4 label Feb 11, 2025
@neoforged-pr-publishing
Copy link

  • Publish PR to GitHub Packages

@CLAassistant
Copy link

CLAassistant commented Feb 11, 2025

CLA assistant check
All committers have signed the CLA.

Signed-off-by: TheSilkMiner <thesilkminer@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.21.4 Targeted at Minecraft 1.21.4
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants