Skip to content

Class: MapstedError

Extends

  • Error

Constructors

Constructor

ts
new MapstedError(
   code, 
   details?, 
   strict?): MapstedError;

Parameters

ParameterTypeDefault valueDescription
codestringundefinedA valid MAPSTED-XXXX string from the error registry.
details?Record<string, unknown>undefinedOptional key/value context. Template params are interpolated into the human-readable message.
strict?booleanfalseControls redactInProduction behavior. When false (default), params listed under redactInProduction are replaced with [REDACTED] in the message (but retained in details).

Returns

MapstedError

Overrides

ts
Error.constructor

Properties

PropertyModifierTypeDescriptionInherited from
codereadonlystringMachine-readable code, e.g. "MAPSTED-1030".-
details?readonlyRecord<string, unknown>Optional structured context data (JSON-serialisable).-
messagepublicstring-Error.message
namepublicstring-Error.name
recoverablereadonlybooleanWhether the caller can meaningfully retry the operation. Determined by the error registry entry for this code.-
stack?publicstring-Error.stack

Methods

toJSON()

ts
toJSON(): {
  code: string;
  details: Record<string, unknown> | undefined;
  message: string;
  recoverable: boolean;
};

JSON-serialisable representation of the error.

Returns

ts
{
  code: string;
  details: Record<string, unknown> | undefined;
  message: string;
  recoverable: boolean;
}
NameType
codestring
detailsRecord<string, unknown> | undefined
messagestring
recoverableboolean