Skip to content

fix: include hint and docs URL in FSTWRN004 warning message#6723

Merged
jean-michelet merged 2 commits into
fastify:mainfrom
aquie00t:fix/fstwrn004-warning-message
May 30, 2026
Merged

fix: include hint and docs URL in FSTWRN004 warning message#6723
jean-michelet merged 2 commits into
fastify:mainfrom
aquie00t:fix/fstwrn004-warning-message

Conversation

@aquie00t

@aquie00t aquie00t commented May 13, 2026

Copy link
Copy Markdown
Contributor

Summary

The FSTWRN004 warning was created in lib/warnings.js with a static
message that contained no %s format placeholder. As a result, the
hint string passed at the call site in fastify.js was silently dropped
by process-warning, and users who triggered the warning never saw the
actionable information about allowErrorHandlerOverride.

Root Cause

process-warning's createWarning only interpolates arguments when the
message contains %s placeholders. With no placeholder present, any
argument passed to the emitter function is a no-op.

Changes

  • lib/warnings.js: Embed the hint and docs URL directly into the
    static message of FSTWRN004.
  • fastify.js: Remove the now-unused string argument from the
    FSTWRN004() call.
  • test/set-error-handler.test.js: Add a test that asserts the
    warning is emitted with name, code, and the docs URL in the
    message when setErrorHandler is called more than once in the same
    scope.

Checklist

@aquie00t aquie00t force-pushed the fix/fstwrn004-warning-message branch 2 times, most recently from ffd699f to eb39da4 Compare May 13, 2026 21:55
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label May 13, 2026
@aquie00t aquie00t closed this May 19, 2026
@aquie00t aquie00t force-pushed the fix/fstwrn004-warning-message branch from eb39da4 to b5e5c37 Compare May 19, 2026 09:05
@aquie00t aquie00t reopened this May 19, 2026
@aquie00t aquie00t force-pushed the fix/fstwrn004-warning-message branch from 6ca1dd4 to 09f2e48 Compare May 19, 2026 09:17
Comment thread docs/Reference/Warnings.md Outdated
Comment thread test/set-error-handler.test.js Outdated
@aquie00t aquie00t force-pushed the fix/fstwrn004-warning-message branch 2 times, most recently from 35a3cef to cb36f93 Compare May 19, 2026 18:55
@aquie00t

Copy link
Copy Markdown
Contributor Author

@jean-michelet ready to merge whenever you are 🙏

@jean-michelet jean-michelet merged commit 47670c1 into fastify:main May 30, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants