4 ms·
Additional structure like, say, a numeric error code? An HttpError could definitely contain the corresponding status code. But I think the bigger point is that
by curun1r 9y ago
Additional structure like, say, a numeric error code? An HttpError could definitely contain the corresponding status code.
But I think the bigger point is that, for libraries, errors should be an enumerated set of possible error conditions, not strings. You say "additional structure", I say the duplicate filename, the invalid email address or, crucially, the error that caused the error...chaining errors is very useful. The multiple returns idiom in Go may make this possible, but it's hacky and strictly worse than languages that can utilize generics and a more richly-typed set of errors.