Kind: Interface
Source: packages/common/exceptions/http.exception.ts
Part of: Common
DescriptionAndOptions groups a human-readable exception description with the HttpExceptionOptions used to configure how an HTTP exception is created or handled. It is typically used internally when normalizing exception constructor arguments into a consistent structure.
Properties
| Property | Type |
|---|---|
description | string |
httpExceptionOptions | HttpExceptionOptions |
Diagram
mermaidgraph LR A[Exception input] --> B[DescriptionAndOptions] B --> C[description: string] B --> D[httpExceptionOptions: HttpExceptionOptions] D --> E[HTTP exception configuration]
Usage
tsimport type { HttpExceptionOptions } from './http.exception';
interface DescriptionAndOptions {
description: string;
httpExceptionOptions: HttpExceptionOptions;
}
const exceptionDetails: DescriptionAndOptions = {
description: 'The requested user could not be found.',
httpExceptionOptions: {
cause: new Error('User lookup returned no result'),
},
};
// Use the normalized values when constructing an HTTP exception.
const { description, httpExceptionOptions } = exceptionDetails;
AI Coding Instructions
- Keep
descriptionas a clear, client-safe string explaining the exception condition. - Pass exception metadata through
httpExceptionOptionsrather than adding unrelated fields to this interface. - Preserve the
causeoption when wrapping lower-level errors so error chains remain traceable. - Use this shape when normalizing overloaded HTTP exception constructor inputs into a single internal representation.
Was this page helpful?