-
Notifications
You must be signed in to change notification settings - Fork 63
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
Small error improvements #71
Conversation
Hm, "internal: return a DAVError instead of an Error" is a bit strange because it wraps
|
Sorry, I never really looked much at the client code before, and it took me a moment to understand the error handling you added there 🙂 I am not entirely sure which approach sounds better. On the one hand, since both are essentially different protocols, separating them seems reasonable. Yet, since they map so closely to each other, maybe not. I think in the client library, both would be easy to implement, but I have no idea how tedious proper handling would be in a client application. On the server side, however, I'd be worried that separating them would result in a lot of noisy code, like "if it's a http error and code X or a dav error and code X, do this, same for code Y, etc." without adding much value. If the only difference is a human-readable error message, getting that from an optional wrapped error seems much easier. Hence I'd slightly lean toward your first suggestion. But it's not a strong opinion and I might very well be missing something. |
This allows callers to access the underlying error via errors.Unwrap.
That way we can avoid having different ways of representing the same error value.
Same as NewOKResponse but for errors.
Instead of making the whole HTTP request fail when a single address object cannot be fetched, return a partial error response.
75abfad
to
132bf83
Compare
Here's how the first approach would look like. |
Builds a detailed HTTPError + Error if the Response is a failure. It contains more context than just the HTTPError.
132bf83
to
0e0d616
Compare
Looks good to me... 🙂 |
Thanks for the feedback! |
cc @bitfehler