Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Should Codec building panic, return Err, or populate default values when missing fields? #10

Answered by frm
shelbyd asked this question in Q&A
Discussion options

You must be logged in to vote

I'm a fan of the Elixir & Ruby way of using a different method (usually ending with !) to indicate it panics.

Thinking from the perspective of the data host, I would rather control my logic by checking if it errored, rather than implementing control flow through exceptions.

I recognise the value of having a panic, though, as it removes any overhead code handling the return of an error. My take is then to have different build methods and suit the potential use cases.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@shelbyd
Comment options

Answer selected by shelbyd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants