Skip to content

NifEncoder::encode should return a Result<NifTerm, Error> instead of just NifTerm #1

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

Closed
hansihe opened this issue Jan 6, 2016 · 1 comment

Comments

@hansihe
Copy link
Member

hansihe commented Jan 6, 2016

As is, it is impossible to fail gracefully in NifEncoder::encode. This is a big design flaw, as things like allocation errors can happen when encoding a value.

When that is done, all existing encoders should be changed to fail gracefully instead of panicking.

@hansihe
Copy link
Member Author

hansihe commented Feb 11, 2016

Thinking this through, it may not be as good of an idea as I initially thought. Changing this would increase how much code you would have to write to encode terms. It also seems like most errors (like allocation errors, write errors) are things you generally don't want to recover from. Closing for now.

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

No branches or pull requests

1 participant