peburrows / goth

Elixir package for Oauth authentication via Google Cloud APIs
http://hexdocs.pm/goth
MIT License
289 stars 111 forks source link

Return errors when API calls fail #13

Closed sadraskol closed 7 years ago

sadraskol commented 7 years ago

When an api fails, let's say the client is deleted, or other various reasons, the current implementation is pretty vague on the reason why the token fetch fails, it would display something like ** (ArithmeticError) bad argument in arithmetic expression.

My implementation is not perfect since it does treat each error use cases but it's a bit more explanatory.

peburrows commented 7 years ago

Awesome, thanks, this looks like a helpful change. I'll get this merged and a new release published today.

cdcme commented 5 years ago

@peburrows Looks like this changeset is no longer in the latest versions. Compare this with this. Goth is now throwing a generic Arithmetic error again. Appears to be in 0.9.0 but not in 0.11.0 forward—is this intentional? Thanks.

peburrows commented 5 years ago

@carlodicelico — the code is still there, it has just been extracted into its own function: https://github.com/peburrows/goth/blob/master/lib/goth/client.ex#L183-L190

Sounds like there might be a different issue. Do you mind providing a few more details about what you're seeing and how to reproduce it?

cdcme commented 5 years ago

Ah! I see, thanks & sorry about that. I think I was getting an error that falls outside the ones checked, but have since fixed it. Thanks again.