fix(types): add responseTime to customErrorMessage callback#372
Open
vikasrathod4299 wants to merge 4 commits intopinojs:masterfrom
Open
fix(types): add responseTime to customErrorMessage callback#372vikasrathod4299 wants to merge 4 commits intopinojs:masterfrom
vikasrathod4299 wants to merge 4 commits intopinojs:masterfrom
Conversation
index.test-d.ts
Outdated
| @@ -48,6 +48,9 @@ pinoHttp<CustomRequest, CustomResponse>({ customSuccessMessage: (req: CustomRequ | |||
| // #customErrorMessage | |||
| pinoHttp({ customErrorMessage: (req: IncomingMessage, res: ServerResponse, error: Error) => `Error - ${error}` }); | |||
Contributor
There was a problem hiding this comment.
instead of overwriting the whole prop you could update the existing config (line 49) to include customErrorMessage with responseTime (avoids redundancy and looks clean) 🙂
Author
There was a problem hiding this comment.
Updated as suggested. Thanks 👍
…lean up redundancy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #359
Updated the
customErrorMessagetype definition to include the 4th argumentresponseTime.This allows users to make full use of all parameters passed to
customErrorMessage.Optionsinterface inindex.d.tsindex.test-d.tsusing 4 parameters