derangeddk / serialize-every-error

This package strives to be an exhaustive alternative to normal error serialization for logging
5 stars 0 forks source link

serializer raises #1

Closed Bladtman242 closed 2 years ago

Bladtman242 commented 2 years ago

It seems that some inputs can cause the serializer to raise an exception. The error given to the error serializer is included as json, in the log line "output for niels" below.

Excerpt from my logs:

good-drive-backend-1  | output for niels {"length":104,"name":"error","severity":"ERROR","code":"42P01","position":"46","file":"parse_relation.c","line":"1381","routine":"parserOpenTable"}
good-drive-backend-1  | There was an error: unhandledRejection TypeError: Cannot convert undefined or null to object
good-drive-backend-1  |     at hasOwnProperty (<anonymous>)
good-drive-backend-1  |     at Module.default (file:///good-drive/node_modules/serialize-every-error/baseSerializer.js:31:23)
good-drive-backend-1  |     at Object.serializeError [as err] (file:///good-drive/node_modules/serialize-every-error/index.js:8:30)
good-drive-backend-1  |     at Pino.asJson (/good-drive/node_modules/pino/lib/tools.js:115:50)
good-drive-backend-1  |     at Pino.write (/good-drive/node_modules/pino/lib/proto.js:198:28)
good-drive-backend-1  |     at Pino.LOG [as error] (/good-drive/node_modules/pino/lib/tools.js:54:21)
good-drive-backend-1  |     at Object.<anonymous> (file:///good-drive/backend/GoodDriveService.js:75:13)
good-drive-backend-1  |     at handleError (/good-drive/node_modules/fastify/lib/error-handler.js:58:18)
good-drive-backend-1  |     at onErrorHook (/good-drive/node_modules/fastify/lib/reply.js:594:5)
good-drive-backend-1  |     at Reply.send (/good-drive/node_modules/fastify/lib/reply.js:119:5)
good-drive-backend-1  | [nodemon] app crashed - waiting for file changes before starting...
hypesystem commented 2 years ago

Great, thanks for reporting this, I'll look into it! ✨

hypesystem commented 2 years ago

The input you've given me doesn't crash it, but I think that's because the printing doesn't show undefined fields, which is the problem.

I'm making a minimal reproducible example and willfix :smile: