freckle/yesod-auth-oauth2

Consider what to do in the case of unexpected profile response

pbrisbin opened this issue · 1 comments

Currently we just call error. This is bad since it'll crash the whole program.

We should either:

  • Throw an IO exception with a useful error message
  • Use Maybe or Either and let the caller decide

The downside of Maybe is that the caller will have no choice but to simply skip setting the Creds. This means the authentication just won't happen, with no indication as to why.

Seems like an IO exception is probably what we want, because:

  • We don't want to crash the program.
  • There isn't anything useful the caller can decide to do in the event that the API contract is incorrect.