Skip to content

Commit

Permalink
Catch errors thrown during login validation (#2406)
Browse files Browse the repository at this point in the history
  • Loading branch information
MinnDevelopment authored Feb 21, 2023
1 parent 8e46689 commit 799b1ac
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/main/java/net/dv8tion/jda/internal/JDAImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -394,14 +394,22 @@ else if (response.code == 401)
}
}.priority();

DataObject userResponse = login.complete();
if (userResponse != null)
try
{
getEntityBuilder().createSelfUser(userResponse);
return;
DataObject userResponse = login.complete();
if (userResponse != null)
{
getEntityBuilder().createSelfUser(userResponse);
return;
}

throw new InvalidTokenException("The provided token is invalid!");
}
catch (Throwable error)
{
shutdownNow();
throw error;
}
shutdownNow();
throw new InvalidTokenException("The provided token is invalid!");
}

public AuthorizationConfig getAuthorizationConfig()
Expand Down

0 comments on commit 799b1ac

Please sign in to comment.