Skip to content

Conversation

jwasinger
Copy link
Collaborator

Afaict, it should be safe to assume that a tree being serialized is not malformed. Otherwise, it is catastrophic (programming error) and we might as well let it panic.

Copy link
Member

@gballet gballet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds like a bad idea in general. Sure finding this means that something is critically wrong, but returning the error would increase the avenues we have for debugging. What is the high-level reason why you want to panic instead?

@jwasinger
Copy link
Collaborator Author

jwasinger commented May 29, 2024

In this case, it doesn't increase the avenues for debugging. A panic will point directly to the place where the error is caused. Returning it does the same.

Seems weird to percolate an internal logic error (that a user of this lib has no reasonable way to recover from) through a public interface.

@jwasinger
Copy link
Collaborator Author

jwasinger commented May 29, 2024

Oh, I just remove the error check and don't panic at all. Happy to add that if it would make debugging easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants