Repository navigation
fix(logger): Keep falsy causes and literal % in error messages - #1779
Merged
Merged
Conversation
- Render an error's cause whenever the error has one, including `0`, `""`, `false`, `null`, and `undefined`, as `util.inspect` does. Only truthy causes were rendered. - An error passed as the first argument is no longer read as a format string, so `%s` in its message stays literal instead of consuming the next argument, matching `console.log`. - Require Craft 3.5.0, the first release that resolves the workspace placeholders the logger's release config uses. The release workflow already runs 3.5.0; older versions would leave them unresolved. Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
BYK
approved these changes
Nov 1, 2026
This branch was successfully deployed
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.
This fixes the Warden findings that were posted on #1773 after it merged.
formatErrorshowed a cause only when it was truthy, sonew Error("x", { cause: 0 })printed justx. It now shows the cause whenever the error has one (0,"",false,null,undefined), asutil.inspectdoes.formatMessageturned errors into strings before callingutil.format, so an error passed first became the format string.logger.info(new Error("Failed for %s"), "extra")printedFailed for extra. The%snow stays literal and the remaining arguments are added after it, asconsole.logdoes.minVersion: raised from 2.33.0 to 3.5.0. The logger workspace uses{{workspaceName}}and{{packageSimpleName}}, and Craft only resolves those from 3.5.0 onward. The release workflow'sgetsentry/craft@v3already installs 3.5.0. Warden said the placeholders are left unresolved, which is wrong for the release workflow, but an older local Craft would have left them as literal text without any error. This raises the minimum for every workspace in this repository.Tests cover each falsy cause and an error message containing
%s. For other output, the build is byte-identical tomainacross about 24,600 formatted records.via @BYK.
--
View Session in Sentry