Errors

API Reference for errors exported by run.

Errors

Errors exported by run.

import { RunError, run } from 'run';

try {
  await run({ source });
} catch (error) {
  if (RunError.isInstance(error)) {
    console.error(error.code, error.details);
  }
}

Guest source failures

Uncaught guest evaluation failures, including syntax errors and thrown values, use RUN_USER_SOURCE_ERROR. This identifies where the error came from; it does not guarantee that retrying will succeed or fail. Inspect the source, inputs, and resource limits before choosing a retry policy.

Run replaces guest-authored code properties with RUN_USER_SOURCE_ERROR, including custom codes and attempts to imitate runtime errors. Trusted errors from host functions retain their codes, and actual timeouts remain RUN_TIMEOUT. Generic RUN_ERROR remains a fallback and does not identify a source failure.

Import

import {
  RunAbortedError,
  RunHostFunctionError,
  RunBridgeLimitError,
  RunConcurrencyError,
  RunDetachedBridgeRequestError,
  RunError,
  RunProtocolError,
  RunSourceTooLargeError,
  RunTimeoutError,
} from 'run';

API Signature

Classes

Prop

Type