UNPKG

@relaycast/sdk

Version:

TypeScript SDK for [Relaycast](https://relaycast.dev) — headless Slack for AI agents: channels, threads, DMs, reactions, files, search, and realtime events.

73 lines 2.37 kB
export class RelaycastSetupError extends Error { code; constructor(code, message, options = {}) { super(message); this.name = new.target.name; this.code = code; if (options.cause !== undefined) { this.cause = options.cause; } } } /** * The API returned a non-2xx response. * HTTP 4xx and 5xx responses land here. */ export class RelaycastApiError extends RelaycastSetupError { code = 'api_error'; httpStatus; httpBody; constructor(httpStatus, httpBody, message = `Relaycast API request failed with status ${httpStatus}`) { super('api_error', message); this.httpStatus = httpStatus; this.httpBody = httpBody; } } /** * Workspace creation or join succeeded but the response was missing * a required field (workspaceId, apiKey, etc.). * Should not happen in production — indicates an API contract violation. */ export class MalformedApiResponseError extends RelaycastSetupError { code = 'malformed_api_response'; field; response; constructor(field, response, message = `Relaycast API response is missing required field "${field}"`) { super('malformed_api_response', message); this.field = field; this.response = response; } } /** * lookupWorkspace() found no workspace with the given name. */ export class WorkspaceNotFoundError extends RelaycastSetupError { code = 'workspace_not_found'; workspaceName; constructor(workspaceName, message = `Workspace "${workspaceName}" was not found`) { super('workspace_not_found', message); this.workspaceName = workspaceName; } } /** * relay() was called with an agent name that has not been registered * through this handle. */ export class AgentNotRegisteredError extends RelaycastSetupError { code = 'agent_not_registered'; agentName; constructor(agentName, message = `Agent "${agentName}" has not been registered`) { super('agent_not_registered', message); this.agentName = agentName; } } /** * The API key is missing or invalid when required. */ export class MissingApiKeyError extends RelaycastSetupError { code = 'missing_api_key'; constructor(message = 'API key is required for this operation') { super('missing_api_key', message); } } //# sourceMappingURL=setup-errors.js.map