Skip to content

Home > @opengovsg/logging > LoggingConfig > serializeError

LoggingConfig.serializeError property ​

Shape a thrown error into the error wire field. Receives an already-normalised Error (any non-Error thrown value is normalised first), set once here for the whole factory. Optional; defaults to the framework-neutral serializeError(). Override to add framework-specific shaping — e.g. mapping a tRPC code to error.kind, or a NestJS HttpException status.

Signature:

typescript
serializeError?: (err: Error) => Record<string, unknown>;