use of net.dv8tion.jda.internal.requests.CallbackContext in project JDA by DV8FromTheWorld.
the class Request method onSuccess.
public void onSuccess(T successObj) {
if (done)
return;
done = true;
api.getCallbackPool().execute(() -> {
try (ThreadLocalReason.Closable __ = ThreadLocalReason.closable(localReason);
CallbackContext ___ = CallbackContext.getInstance()) {
onSuccess.accept(successObj);
} catch (Throwable t) {
RestActionImpl.LOG.error("Encountered error while processing success consumer", t);
if (t instanceof Error) {
api.handleEvent(new ExceptionEvent(api, t, true));
throw (Error) t;
}
}
});
}
use of net.dv8tion.jda.internal.requests.CallbackContext in project JDA by DV8FromTheWorld.
the class Request method onFailure.
public void onFailure(Throwable failException) {
if (done)
return;
done = true;
api.getCallbackPool().execute(() -> {
try (ThreadLocalReason.Closable __ = ThreadLocalReason.closable(localReason);
CallbackContext ___ = CallbackContext.getInstance()) {
onFailure.accept(failException);
if (failException instanceof Error)
api.handleEvent(new ExceptionEvent(api, failException, false));
} catch (Throwable t) {
RestActionImpl.LOG.error("Encountered error while processing failure consumer", t);
if (t instanceof Error) {
api.handleEvent(new ExceptionEvent(api, t, true));
throw (Error) t;
}
}
});
}
Aggregations