Package io.karatelabs.js
Class JsRejectionException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
io.karatelabs.js.JsRejectionException
- All Implemented Interfaces:
Serializable
The carrier that takes a JS promise rejection across the Java boundary, and
the only exception type the engine ever unwraps back into a JS reason.
JsPromise.toFuture() completes exceptionally with one of these, so a
Java consumer sees it per CompletableFuture norms — usually nested
inside a CompletionException or ExecutionException.
Coming the other way, an arbitrary Java exception never masquerades as a JS
rejection: a stage that failed with something else is converted by the same
host-error rules a catch clause applies, and host cancellation
(EngineInterruptedException) is re-thrown rather than turned into a
catchable reason.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
JsRejectionException
-
-
Method Details
-
getReason
The exact JS value the promise was rejected with — anErrorobject in the common case, but JS can reject with anything.
-