Skip to content

Class: MNotifyError

Defined in: errors.ts:31

Structured error representing an mNotify API failure.

Extends

  • Error

Constructors

Constructor

ts
new MNotifyError(
   message, 
   statusCode, 
   data?, 
   context?, 
   cause?): MNotifyError;

Defined in: errors.ts:32

Parameters

ParameterType
messagestring
statusCodenumber
data?unknown
context?MNotifyErrorContext
cause?unknown

Returns

MNotifyError

Overrides

ts
Error.constructor

Properties

cause?

ts
readonly optional cause?: unknown;

Defined in: errors.ts:37

Inherited from

ts
Error.cause

context?

ts
readonly optional context?: MNotifyErrorContext;

Defined in: errors.ts:36


data?

ts
readonly optional data?: unknown;

Defined in: errors.ts:35


statusCode

ts
readonly statusCode: number;

Defined in: errors.ts:34

Methods

toJSON()

ts
toJSON(): Record<string, unknown>;

Defined in: errors.ts:87

Returns

Record<string, unknown>


withContext()

ts
withContext(context): MNotifyError;

Defined in: errors.ts:47

Returns a new MNotifyError with merged context.

Parameters

ParameterType
contextMNotifyErrorContext

Returns

MNotifyError


fromUnknown()

ts
static fromUnknown(
   error, 
   fallbackMessage, 
   statusCode, 
   context?, 
   data?): MNotifyError;

Defined in: errors.ts:63

Creates an MNotifyError from an unknown value. Preserves the original error if it is already an MNotifyError.

Parameters

ParameterType
errorunknown
fallbackMessagestring
statusCodenumber
context?MNotifyErrorContext
data?unknown

Returns

MNotifyError