-
Notifications
You must be signed in to change notification settings - Fork 117
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
Error struct #54
Comments
Reraising Do you think that it's worth differentiating between server errors and client errors? I've historically found a lot of value in doing so when working with HTTP clients, to make it easier to determine whether a given error is transient and should be retried, or if it's resulting from bad user input / programmer error. |
We don't do the client/server distinction in Mint, so I'm afraid it would be a bit annoying to do here 😄 |
I've started a branch for this. I just need to ensure that we're capturing all of the mint errors correctly |
One option here is to say that we return |
Yeah, that's probably the right way to go. I was worried that having that inconsistency would make it harder for people to pattern match on. |
is it possible that in this place
we can also define the return behaviour of success response, such there is an opportunity to name finch to be your own representation.
|
I think this would be better handled within a module in your application. For example, you could define something like this: defmodule MyApp.MyConfiguredFinch do
defstruct [...fields]
def request(request) do
# or use a `case` if you also want to transform errors
with {:ok, response} <- Finch.request(request, MyConfiguredFinch) do
to_custom_response_struct(response)
end
end
defp to_custom_response_struct(response) do
%__MODULE__{...}
end
end |
Closing this for now. |
We should have an exception that we can use to capture different errors. I'm not sure if we should wrap over the
Mint
errors or not. But it seems like we might want to for consistency.The text was updated successfully, but these errors were encountered: