Skip to content

Conversation

@vikasrathod4299
Copy link

Fixes #359

Updated the customErrorMessage type definition to include the 4th argument responseTime.

This allows users to make full use of all parameters passed to customErrorMessage.

  • Updated Options interface in index.d.ts
  • Added test case to index.test-d.ts using 4 parameters

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

index.test-d.ts Outdated
pinoHttp<CustomRequest, CustomResponse>({ customSuccessMessage: (req: CustomRequest, res: CustomResponse) => 'Success' });

// #customErrorMessage
pinoHttp({ customErrorMessage: (req: IncomingMessage, res: ServerResponse, error: Error) => `Error - ${error}` });
Copy link
Contributor

@lokeshwar777 lokeshwar777 Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of overwriting the whole prop you could update the existing config (line 49) to include customErrorMessage with responseTime (avoids redundancy and looks clean) 🙂

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated as suggested. Thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: customErrorMessage actually got passed 4 arguments, but it's ts declaration only has 3 arguments

3 participants