Skip to main content

Function: describeError()

describeError(error, options?): ErrorDescription

Defined in: packages/messaging/src/describe-error.ts:91

Describes a thrown value for a log line, so that a handler failure can be diagnosed from the log: the class, the code (a SQLSTATE for a driver error) and a redacted message. It never includes a payload: nothing but the error is read; the message is shown only for errors whose text the library or the engine wrote (see messageIsTrusted); it is scrubbed for secret shapes and capped; and quoted literals, which is where a driver echoes the offending value, are elided unless the SQLSTATE class says the message names only schema objects. An application error's text is withheld, since a handler may have put a value in it; its frames, at debug, say where it was thrown.

Parameters​

error​

unknown

Anything thrown.

options?​

message: false for a failure whose message may carry a credential (a token verifier), where only the class and code are kept. stack adds the frames, for a debug line.

message?​

boolean

stack?​

boolean

Returns​

ErrorDescription

A plain object, safe to log.