Skip to content

@iamcalegari/mongoat / MongoatDriverError

Class: MongoatDriverError

Defined in: src/errors/index.ts:115

Wrap sanitizado de um erro re-lançado pelo driver mongodb. .message é estável e nunca inclui stack trace/detalhes internos; o erro original do driver fica preservado em .cause para quem quiser inspecionar. Nunca construído a partir de JSON.stringify(err).

code default: 'DRIVER_ERROR' — códigos numéricos conhecidos do driver são mapeados para valores estáveis (ex.: 11000'DUPLICATE_KEY').

Extends

Constructors

Constructor

new MongoatDriverError(message, options?): MongoatDriverError

Defined in: src/errors/index.ts:116

Parameters

message

string

options?
cause?

unknown

code?

string

Returns

MongoatDriverError

Overrides

MongoatError.constructor

Properties

code

readonly code: string

Defined in: src/errors/index.ts:23

Inherited from

MongoatError.code


suppressed?

optional suppressed?: unknown[]

Defined in: src/errors/index.ts:38

Errors from secondary, best-effort operations that failed while this error was being handled — never the primary cause of failure. Absent (undefined) unless at least one secondary failure was recorded; the array can accumulate more than one entry across a single error's lifecycle.

Each entry is the raw error captured from the secondary operation, not sanitized. Never serialize a MongoatError (or this field alone) with JSON.stringify — the same discipline already applied to .cause.

Inherited from

MongoatError.suppressed