-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
[BUG] Client get request throws HttpException instead of LoginException #73
Comments
Is the API key valid, but missing certain permissions? |
Nope I gave a wrong api key just for testing I gave 'some-token' as api key just to test that code |
How do you know it's throwing a HttpException? If we get a 403 from the panel, we throw a LoginException (see here: https://github.com/mattmalec/Pterodactyl4J/blob/develop/src/main/java/com/mattmalec/pterodactyl4j/requests/Request.java#L73-L76) |
With the code up there if I don't catch the HttpException it simply makes my application crash, I'm forced to handle the HttpException as a login issue if I want the application to gracefully crash. It's not an OkHttp HttpException but your library's HttpException (com.mattmalec.pterodactyl4j.exceptions.HttpException) |
It seems that the panel if the API key is wrong doesn't return 403 code but an 401 code |
Definitely looks like a bug then - want to throw up a PR? Sounds like we can just have a 401 case and fallthrough to the 403 logic |
I could do that but won't it be better to simply report this issue to pterodactyl directly? At least to know if it is expected behaviour from the panel to return 401 instead of 403 |
I'm going to make a PR for this bug and another bug that I found. |
Hello, I'm trying to make some check ups before running my code.
I do this code to get some information and to check if the panel is acccessible and I have a correct API token.
But when I'm unauthenticated. it throws HttpException instead of LoginException is this expected behaviour?
The javadoc says "Throws: LoginException – If the API key is incorrect"
The text was updated successfully, but these errors were encountered: