Skip to content
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 messages for 400 return codes #6

Closed
WolfgangFahl opened this issue Dec 25, 2019 · 1 comment
Closed

error messages for 400 return codes #6

WolfgangFahl opened this issue Dec 25, 2019 · 1 comment

Comments

@WolfgangFahl
Copy link

  • berserk version: 0.3.1
  • Python version: 3.7.4
  • Operating System: Mac OS

Description

According to https://lichess.org/api some calls will return error information with a 404 status code e.g. "Authorization header missing".

What I Did

   def abort(self):
        try:
            self.client.bots.abort_game(self.game_id)
            return True
        except requests.exceptions.HTTPError as httpError:
            return self.handle(httpError)

   def handle(self,httpError):
        if self.debug:
            print (httpError)
        return False

The httpError does not seem to carry any detail information which might be necessary for a proper control flow.

@WolfgangFahl WolfgangFahl changed the title error messages for 404 returns error messages for 400 return codes Dec 25, 2019
WolfgangFahl added a commit to WolfgangFahl/berserk that referenced this issue Dec 25, 2019
@rhgrant10
Copy link
Owner

@WolfgangFahl per your comments on your PR, it was easier to just incorporate your changes. Versions 0.5.0 and later now provide custom exception types for response errors that exposes the HTTP code, reason, and also the cause of the error as reported by the API as attributes and in the exception message.

rwst pushed a commit to rwst/berserk that referenced this issue Dec 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants