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

Unsuccessful requests throws Error instead of Exception #1734

Open
SimonCockx opened this issue Mar 21, 2024 · 0 comments
Open

Unsuccessful requests throws Error instead of Exception #1734

SimonCockx opened this issue Mar 21, 2024 · 0 comments

Comments

@SimonCockx
Copy link

SimonCockx commented Mar 21, 2024

When a GitHub API call returns a non-success status (e.g., 404 NOT FOUND), Jcabi throws an AssertionError. This however is not an Exception, but rather an Error, which is against the guidelines of the Java spec.

To quote the Oracle docs:

Error is the superclass of all the exceptions from which ordinary programs are not ordinarily expected to recover.

We would like to handle this gracefully in our application though. An ugly workaround is to catch this AssertionError, but the Java specification clearly states that this is against the goal of Errors. This should be an (unchecked?) exception instead.

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

1 participant