Skip to content

fix: add missing responseTime parameter to customErrorMessage type#413

Open
antonisetkowicz wants to merge 1 commit into
pinojs:masterfrom
antonisetkowicz:fix/custom-error-message-response-time-type
Open

fix: add missing responseTime parameter to customErrorMessage type#413
antonisetkowicz wants to merge 1 commit into
pinojs:masterfrom
antonisetkowicz:fix/custom-error-message-response-time-type

Conversation

@antonisetkowicz

Copy link
Copy Markdown

Summary

The customErrorMessage callback receives 4 arguments at runtime (req, res, error, responseTime) in logger.js:128, but the TypeScript declaration in index.d.ts only declared 3 parameters — missing responseTime: number.

This is inconsistent with customSuccessMessage, which already includes responseTime in its type declaration.

Changes

  • index.d.ts: Added responseTime: number parameter to customErrorMessage type
  • index.test-d.ts: Added type test with responseTime parameter, updated combined options test

Verification

  • All 64 existing tests pass
  • Type tests (tsd) pass
  • 100% code coverage maintained

Closes #359

The customErrorMessage callback receives 4 arguments at runtime
(req, res, error, responseTime) but the TypeScript declaration
only declared 3. This aligns the type with the actual call site
at logger.js:128 and matches the pattern used by customSuccessMessage.

Closes pinojs#359
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

1 participant