export interface ChainedErrorExtendedOptions { code?: string; statusCode?: number; expose?: boolean; correlationId?: string; } export interface ChainedErrorOptions extends ChainedErrorExtendedOptions { message: string; cause?: Error; } export default class ChainedError extends Error { /** * Optional cause associated with error. */ readonly _cause?: Error; /** * An optional code associated with error. */ readonly code: string | undefined; /** * An optional HTTP status code associated with error. */ readonly statusCode: number | undefined; /** * An optional correlation ID associated with error. */ readonly correlationId: string | undefined; /** * Can this error be exposed safely to end-user? */ expose: boolean | undefined; constructor(options: ChainedErrorOptions | string, causeParam?: Error, extendedOptions?: ChainedErrorExtendedOptions); /** * For compatibility with bunyan err serializer. * * See https://github.com/trentm/node-bunyan/blob/master/lib/bunyan.js#L1125 */ cause(): Error | undefined; }