Catch-all clauses should catch Throwable instead of Exception class.

Base class for all exception is Throwable, and it's possible to skip some of them by catching only Exception.
e.g., throwing AssertionError will lead to thread termination
This commit is contained in:
Leonid Shalupov 2020-08-30 15:54:54 +02:00
parent e6b9fd892f
commit 10ad9b1a95
2 changed files with 3 additions and 3 deletions

View File

@ -599,7 +599,7 @@ public abstract class BaseAbilityBot extends DefaultAbsSender implements Ability
boolean runSilently(Callable<Boolean> callable, String name) {
try {
return callable.call();
} catch(Exception ex) {
} catch(Throwable ex) {
log.error(format("Reply [%s] failed to check for conditions. " +
"Make sure you're safeguarding against all possible updates.", name));
}

View File

@ -214,7 +214,7 @@ public class DefaultBotSession implements BotSession {
}
log.debug(e.getLocalizedMessage(), e);
interrupt();
} catch (Exception global) {
} catch (Throwable global) {
log.error(global.getLocalizedMessage(), global);
try {
synchronized (lock) {
@ -322,7 +322,7 @@ public class DefaultBotSession implements BotSession {
} catch (InterruptedException e) {
log.debug(e.getLocalizedMessage(), e);
interrupt();
} catch (Exception e) {
} catch (Throwable e) {
log.error(e.getLocalizedMessage(), e);
}
}