-
-
Notifications
You must be signed in to change notification settings - Fork 718
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
Invalid token exception #2025
Invalid token exception #2025
Conversation
Ah great, what did I mess up now... |
8c9dbbd
to
48909bc
Compare
Oh thank god I fixed that(For those visiting this later I basically accidently added 7 commits from a different branch, which I removed now). |
I'd make this a draft PR unless it's finished, if it's finished you should check the TO-DO's you added. |
src/main/java/net/dv8tion/jda/internal/utils/InvalidTokenException.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/internal/utils/InvalidTokenException.java
Outdated
Show resolved
Hide resolved
@@ -284,7 +280,7 @@ public int login(String gatewayUrl, ShardInfo shardInfo, Compression compression | |||
String token = authConfig.getToken(); | |||
setStatus(Status.LOGGING_IN); | |||
if (token == null || token.isEmpty()) | |||
throw new LoginException("Provided token was null or empty!"); | |||
throw new InvalidTokenException("Provided token was null or empty!"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DV8FromTheWorld doesn't it make more sense to throw an IllegalArgument here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imo no, we should use this exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check should have been done before hand in JDABuilder, not here.
We should move this token check to the JDABuilder and use Checks.notEmpty
to ensure it is valid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this be done in this PR or should we make a separate PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can push this to another PR
src/main/java/net/dv8tion/jda/internal/utils/InvalidTokenException.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/internal/utils/InvalidTokenException.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/internal/utils/InvalidTokenException.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/internal/utils/InvalidTokenException.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/internal/utils/InvalidTokenException.java
Outdated
Show resolved
Hide resolved
Whats your idea behind this? LoginException perfectly fits here imo. |
There have been discussions about this in lib-dev, check there for the exact motivation. One of them was because this is unchecked, instead of the annoying checked exception we're used to having |
This PR seems to be completed. |
void login() throws LoginException; | ||
void login() ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Remove the space between the parenthesis and the semicolon.
Edit: I just saw that there is generally a space after each method which had a throws LoginException
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I need to remove all of them right?
Should I keep the file in |
src/main/java/net/dv8tion/jda/api/sharding/DefaultShardManager.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/internal/utils/InvalidTokenException.java
Outdated
Show resolved
Hide resolved
src/main/java/net/dv8tion/jda/internal/utils/InvalidTokenException.java
Outdated
Show resolved
Hide resolved
11b4240
to
e008e01
Compare
I have applied the changes suggested in the code review. |
6a8bda0
to
9ae0f6f
Compare
Co-authored-by: Tais993 <49957334+Tais993@users.noreply.github.com>
…tion.java Co-authored-by: Tais993 <49957334+Tais993@users.noreply.github.com>
9ae0f6f
to
6fde85d
Compare
I have made the necessary changes quite some time ago yet this PR is not receiving any recognition. |
src/main/java/net/dv8tion/jda/api/exceptions/InvalidTokenException.java
Outdated
Show resolved
Hide resolved
Also, https://github.com/DV8FromTheWorld/JDA/pull/2025/files#r917301036 still has not been addressed. This PR hasn't had much attention put on it because it is extremely low priority. We are trying to get the massive breaking changes done so we can exit Alpha. This will be included in the alpha, but as one of the last things to get us over the finish line. |
…tion.java Co-authored-by: Austin Keener <keeneraustin@yahoo.com>
Pull Request Etiquette
Changes
Closes Issue: NaN
Description
Replaces
LoginException
withInvalidTokenException
TODO:
Closes issue: https://github.com/DV8FromTheWorld/JDA/projects/5#card-75890666