-
-
Notifications
You must be signed in to change notification settings - Fork 89
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
Bugfix - Handling blocked users gracefully when reacting to their messages #412
Bugfix - Handling blocked users gracefully when reacting to their messages #412
Conversation
can't catch |
iirc, |
queue is async indeed, so a try-catch doesn't work. |
.queue(ignored -> {},
exception -> {
if (exception instanceof ErrorResponseException && ((ErrorResponseException) exception).getErrorResponse() == ErrorResponse.REACTION_BLOCKED) {
return;
}
exception.printStackTrace();
}); is this better? |
u have to use our logging system, not |
The best thing to do is to I think staying with |
Then you would throw from within the JDA context where the lambda is executed, which is detached from our flow - not good. If you stick with If you stick with And all of that just because you want to throw an exception, you do not even have business logic or anything that requires a blocking call. Thats not really worth it. tldr, dont block our threads, use queue. (in this particular case it would actually be safe though, since as of today, BotCore doesnt manage EventListeners itself but just forward them to JDA directly - so they dont share an executorservice with slash commands) |
that should do it. |
application/src/main/java/org/togetherjava/tjbot/commands/basic/SuggestionsUpDownVoter.java
Outdated
Show resolved
Hide resolved
I don't know or it should, please give the full stacktrace |
Sounds like you logged the error now. Didnt you want to ignore it and only log unknown failures? Whats the code that produced this? |
I commented the part that ignores the error, for the sake of seeing a stacktrace, as I couldn't think of any other way to make it fail. |
I found another way to make it fail. |
Not sure what your question or confusion is, to be honest. This is the expected behavior - it logs the unknown error. Looks good to me 👍 |
I wasn't sure about the when I look at it now, seems like its JDA's way to handle async exceptions. |
ah yeah, that's just the exception, scroll up and you see the cause.
There's a ton of ways to make it fail, but we shouldn't do anything with this. |
application/src/main/java/org/togetherjava/tjbot/commands/basic/SuggestionsUpDownVoter.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Tais993 <49957334+Tais993@users.noreply.github.com>
Zabuzard, can you review please? |
application/src/main/java/org/togetherjava/tjbot/commands/basic/SuggestionsUpDownVoter.java
Show resolved
Hide resolved
Kudos, SonarCloud Quality Gate passed! |
warped the line that reacts to the message in a
try catch
block. see file changes.resolves #406.