Skip to main content
Every error the App Kit SDK throws for Onramp is a KitError, exported from @circle-fin/app-kit. Its structured fields let you branch on the failure type instead of parsing message strings. For a full integration walkthrough, see the embed widget quickstart.

KitError fields

Prefer type and recoverability for control flow. They are the stable, forward-compatible contract. Use name and code only for exact matching, logging, and telemetry.

Error handling

Catch a KitError and branch on type and recoverability to decide how to recover:
TypeScript

Common error codes

HTTP status code mapping

createSessionRouteHandler maps thrown errors to HTTP status codes automatically: The handler also returns:
  • 405 Method Not Allowed for any method other than POST.
  • 400 Bad Request if the body cannot be parsed as JSON.
  • 401 Unauthorized if your authorize callback returns false.
Upstream response bodies are never echoed into the response. Only the status code and length of the upstream response are kept on KitError.cause for diagnostic purposes.

Error sources

Runtime widget errors are surfaced through the INITIALIZATION_ERROR event rather than thrown. See Handle lifecycle events.