Skip to content

Error Handling

The TypeScript SDK throws ConfigureError for API, validation, permission, and network failures.

ts
import { ConfigureError, ErrorCode } from "configure";

try {
  await profile.executeTool(toolCall);
} catch (error) {
  if (error instanceof ConfigureError) {
    if (error.code === ErrorCode.ACCESS_DENIED) {
      // Tool was not enabled, user permission is missing, or the action is blocked.
    }
    if (error.code === ErrorCode.TOOL_NOT_CONNECTED) {
      // Prompt the user to connect the required connector.
    }
  }
}

Common cases:

  • Invalid agent handle: constructor validation fails before a request is sent.
  • Disabled tool: profile.executeTool() rejects connector/action calls not enabled by profile.tools(options).
  • Missing connector: connector-backed calls return a connector error.
  • Rate limit or quota: reads may fail with a rate/quota error.
  • Permission filtering: search may return fewer results with filtered metadata instead of throwing.

Do not parse error strings. Use ConfigureError.code and structured fields.

Personalization infrastructure for agents