Search in sources :

Example 6 with ExceptionEvent

use of net.dv8tion.jda.api.events.ExceptionEvent 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;
            }
        }
    });
}
Also used : ExceptionEvent(net.dv8tion.jda.api.events.ExceptionEvent) ThreadLocalReason(net.dv8tion.jda.api.audit.ThreadLocalReason) CallbackContext(net.dv8tion.jda.internal.requests.CallbackContext)

Aggregations

ExceptionEvent (net.dv8tion.jda.api.events.ExceptionEvent)6 JDAImpl (net.dv8tion.jda.internal.JDAImpl)4 ByteBuffer (java.nio.ByteBuffer)2 ThreadLocalReason (net.dv8tion.jda.api.audit.ThreadLocalReason)2 User (net.dv8tion.jda.api.entities.User)2 CallbackContext (net.dv8tion.jda.internal.requests.CallbackContext)2 TweetNaclFast (com.iwebpp.crypto.TweetNaclFast)1 WebSocket (com.neovisionaries.ws.client.WebSocket)1 PointerByReference (com.sun.jna.ptr.PointerByReference)1 TIntLongMap (gnu.trove.map.TIntLongMap)1 TIntObjectMap (gnu.trove.map.TIntObjectMap)1 TIntLongHashMap (gnu.trove.map.hash.TIntLongHashMap)1 TIntObjectHashMap (gnu.trove.map.hash.TIntObjectHashMap)1 java.net (java.net)1 Buffer (java.nio.Buffer)1 IntBuffer (java.nio.IntBuffer)1 ShortBuffer (java.nio.ShortBuffer)1 java.util (java.util)1 java.util.concurrent (java.util.concurrent)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1