Seal
SDK reference

Error types

The typed errors the SDK throws, and how to branch on them.

Every SDK error extends GateError, so a single instanceof GateError catches all of them. Branch on the specific subclasses when you need the detail.

import {
  GateError,
  GateApiError,
  ApprovalRejectedError,
  ApprovalExpiredError,
  ApprovalPendingError,
  WebhookVerificationError,
} from "@seal-dev/sdk";
ErrorThrown byExtra properties
GateErrorbase class — never directly
GateApiErrorany non-2xx API responsestatus: number, body: unknown
ApprovalRejectedErrorrequire() on rejectionapproval: ApprovalRequestView, feedback: string | null
ApprovalExpiredErrorrequire() on expiryapproval: ApprovalRequestView
ApprovalPendingErrorrequire() on client timeout / abortapproval: ApprovalRequestView
WebhookVerificationErrorverifyWebhook() on any failure

Branching

import { gate } from "./gate.js";
import { ApprovalRejectedError, ApprovalExpiredError, ApprovalPendingError } from "@seal-dev/sdk";

try {
  const approval = await gate.require(input, { timeoutMs: 60_000 });
  await act(approval);
} catch (err) {
  if (err instanceof ApprovalRejectedError) {
    // A human said no. err.feedback carries their reason.
  } else if (err instanceof ApprovalExpiredError) {
    // Nobody decided in time; the policy's onTimeout applied.
  } else if (err instanceof ApprovalPendingError) {
    // Still pending after your client deadline — resume later with the id.
    await scheduleRecheck(err.approval.id);
  } else {
    throw err;
  }
}

ApprovalPendingError does not mean the request failed — it means your client stopped waiting. The request is still live on the server; poll it again with gate.resume(id).

On this page