Skip to content

Commit 799b1ac

Browse files
Catch errors thrown during login validation (#2406)
1 parent 8e46689 commit 799b1ac

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/main/java/net/dv8tion/jda/internal/JDAImpl.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -394,14 +394,22 @@ else if (response.code == 401)
394394
}
395395
}.priority();
396396

397-
DataObject userResponse = login.complete();
398-
if (userResponse != null)
397+
try
399398
{
400-
getEntityBuilder().createSelfUser(userResponse);
401-
return;
399+
DataObject userResponse = login.complete();
400+
if (userResponse != null)
401+
{
402+
getEntityBuilder().createSelfUser(userResponse);
403+
return;
404+
}
405+
406+
throw new InvalidTokenException("The provided token is invalid!");
407+
}
408+
catch (Throwable error)
409+
{
410+
shutdownNow();
411+
throw error;
402412
}
403-
shutdownNow();
404-
throw new InvalidTokenException("The provided token is invalid!");
405413
}
406414

407415
public AuthorizationConfig getAuthorizationConfig()

0 commit comments

Comments
 (0)