@beignet/core
Version:
Core framework primitives for Beignet
41 lines • 1.25 kB
TypeScript
/**
* Standard error response schema and utilities for Beignet
*/
import type { AppError, ErrorDef } from "./catalog.js";
/**
* Standard Beignet error response body.
*/
export interface ErrorResponseBody {
/**
* Stable machine-readable error code.
*/
code: string;
/**
* Human-readable error message.
*/
message: string;
/**
* Optional structured details.
*
* These details are sent to clients. Beignet does not automatically redact
* app-owned response details, so only include values that are safe to expose.
*/
details?: unknown;
/**
* Optional request ID for support and log correlation.
*/
requestId?: string;
}
/**
* Create a standard error response body and omit undefined optional fields.
*/
export declare function createErrorResponseBody(args: ErrorResponseBody): ErrorResponseBody;
/**
* Check whether a value looks like a standard Beignet error response body.
*/
export declare function isErrorResponseBody(value: unknown): value is ErrorResponseBody;
/**
* Convert an `AppError` to a standard error response body.
*/
export declare function toErrorResponseBody(err: AppError<ErrorDef>): ErrorResponseBody;
//# sourceMappingURL=response.d.ts.map