Class JSRejection

All Implemented Interfaces:
Serializable

public class JSRejection extends RuntimeException
A JavaScript promise rejected with something that is not a Java throwable.

Thrown by Async.await(org.teavm.jso.core.JSPromise) when a platform call fails: a binding that refuses, a request that could not be sent, a stream that broke. The message is what JavaScript rejected with, its stack when it had one.

Unchecked, because every binding on Env reads as a plain method call and a checked exception on each of them would be ceremony rather than safety. A handler that wants to survive a failing binding catches this; one that does not lets the invocation fail, which is what the platform reports.

Since:
1.0.0
See Also:
  • Constructor Details

    • JSRejection

      public JSRejection(String message)
      Parameters:
      message - what the promise rejected with