-
Notifications
You must be signed in to change notification settings - Fork 75
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
Clarify error handling design #363
Comments
As a new user, going through the documentation I kept seeing examples that simply matched on left and right, and printed that. It was never clear to me whether "right" was a complete success, or simply a lack of exceptional conditions such as connect failures. Or, put another way, were 400 and 404 rights or lefts? Did I need to handle a 30x? I started out thinking if I got a right, then I was getting an authorized response to the API call I made, but looking at how status code was present only on right, I started to question that assumption. So, from my perspective, that's what I wish was made clear. |
By the way, somewhat related but not totally, right now private def autoPaginate[F[_]: Sync, T]
(call: Pagination => F[Either[GHException, GHResult[List[T]]]]): EitherT[F, GHException, List[T]] = {
for {
firstPage <- EitherT(call(Pagination(1, 100)))
pages = getPages(firstPage).map(Pagination(_, 100))
restPages <- EitherT(pages.traverse(call(_)).map(_.sequence))
} yield firstPage.result ++ restPages.flatMap(_.result)
} Whatever path you take, it would be useful to have those available. |
we've removed type aliases in https://github.com/47degrees/github4s/blob/master/github4s/src/main/scala/github4s/GithubResponses.scala |
this is done closing |
The relationship
GHResult
/GHResponse
could be more useful, e.g.That way we don't lose status code and headers on the unhappy path.
Also, error handling should be front and center on the getting started.
The text was updated successfully, but these errors were encountered: