Management API Error Handling Utilities (management/errors.ts)

corsair · packages/corsair/core/management/errors.ts · typescript · Apache-2.0
integration, dev-tools, lang:typescript, tag:error-handling

Provides custom error classes and JSON response helpers for management API error serialization and handling.

// Source: https://github.com/corsairdev/corsair | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
// ─────────────────────────────────────────────────────────────────────────────
// Management API error type and JSON response helpers.
// Response body shape: { error, message?, ...extra }. Errors thrown from
// operations are caught by the handler and serialized via errorResponse().
// ─────────────────────────────────────────────────────────────────────────────

export class ManagementApiError extends Error {
	readonly status: number;
	readonly code: string;
	readonly extra: Record<string, unknown>;

	constructor(
		status: number,
		code: string,
		message?: string,
		extra: Recor

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key