Pterodactyl4J
Pterodactyl4J copied to clipboard
[BUG] Client get request throws HttpException instead of LoginException
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.
private void checkoutAccount() {
try {
Account account = this.client.retrieveAccount()
.timeout(this.configuration.getTimeout(), TimeUnit.MILLISECONDS)
.execute();
if (!account.isRootAdmin())
Bootstrap.crash("Pterodactyl account is missing permissions. Administration permissions are required by AtlasNetwork.");
LOGGER.info("Connected as {}!", account.getUserName());
} catch (LoginException | HttpException e) {
Bootstrap.crash("Could not open connection with '" +
this.configuration.getUrl() + ": Invalid Authentication 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"