Open themihai opened 8 years ago
To be honest, I can't recall whether we considered the panics to be preferable or just a shortcut, at the time.
But I'd love to have a stronger opinion about the decision one way or the other. Do you think you'd be up for sharing some thoughts on what would make error values a better call here? (Any particular examples that have been a nuisance?)
As far as I know the panics are supposed to be exceptional cases but in this project they seem to be the norm. On a web service it could terminate the program/server. You can recover but again that's supposed to be used in exceptional cases so that you can catch "unexpected" panics not ordinary errors. I think a better approach would be to use a custom error type if you need more data. See for example https://golang.org/pkg/net/url/#Error . That way you have context information and you can also terminate the program/call cleanly. Another use cases is testing. You don't want your test suite to panic... It's also worth to note that the official recommendation is to return errors.
Is the panic everywhere on purpose?