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

(*ProtoNode).RawData use incorrectly panic instead of returning #90

Closed
Jorropo opened this issue Sep 27, 2022 · 2 comments
Closed

(*ProtoNode).RawData use incorrectly panic instead of returning #90

Jorropo opened this issue Sep 27, 2022 · 2 comments
Assignees
Labels
need/triage Needs initial labeling and prioritization

Comments

@Jorropo
Copy link
Contributor

Jorropo commented Sep 27, 2022

Where this was found: ipfs/kubo#9297

(*ProtoNode).RawData use incorrectly panics, there are cases where consumers can because of bad options trigger an error.

My dumb first instict would be to make it return ([]byte, error) but AFAIT this is trying to fit an interface so we can't do this.

I guess the alternative is to do the serialisation in the write functions (which do return errors) and save the serialised bytes instead.

@Jorropo Jorropo added the need/triage Needs initial labeling and prioritization label Sep 27, 2022
@rvagg rvagg moved this to 🥞 Todo in IPLD team's weekly tracker Sep 27, 2022
@rvagg rvagg self-assigned this Sep 27, 2022
@ipfs ipfs deleted a comment from welcome bot Sep 27, 2022
rvagg added a commit that referenced this issue Sep 28, 2022
@rvagg
Copy link
Member

rvagg commented Sep 28, 2022

Gentle approach: #91

Proper approach is to stick an error on that return and accept the breakage. There's going to be a lot of breakage from that, but that might be a price worth paying to get rid of a panic. I'm confident that #91 gets the majority case, but there's things it won't catch (mentioned there), but also if the hasher is just plain broken in some way beyond not just being registered! Should that rightly be classified as a runtime error? 🤷 Maybe a broken hasher should panic?

rvagg added a commit that referenced this issue Sep 30, 2022
@rvagg
Copy link
Member

rvagg commented Oct 4, 2022

#91 and #92 should address this

@rvagg rvagg closed this as completed Oct 4, 2022
Repository owner moved this from 🥞 Todo to 🎉 Done in IPLD team's weekly tracker Oct 4, 2022
Jorropo pushed a commit to ipfs/boxo that referenced this issue Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/triage Needs initial labeling and prioritization
Projects
None yet
Development

No branches or pull requests

2 participants