refactor: use format to construct errors in utils/library-manifest#13650
refactor: use format to construct errors in utils/library-manifest#13650Planeshifter wants to merge 1 commit into
format to construct errors in utils/library-manifest#13650Conversation
Rewrite the two value-interpolating `TypeError` messages in the main implementation to build their message via `@stdlib/string/format` instead of string concatenation. `format` is the canonical error construction utility across the `utils` namespace: every other value-interpolating throw (~140 sibling packages) uses it, leaving this package as the sole outlier constructing error messages by concatenation. The message text is preserved byte-for-byte (`%s` coerces values identically to concatenation), so no observable behavior or test expectation changes; the package tests assert only the error type. `@stdlib/string/format` has no dependencies and thus introduces no circular dependency, consistent with the existing note in `main.js` regarding avoiding stdlib packages for the hot-path built-ins. Signed-off-by: Philipp Burckhardt <pburckhardt@outlook.com>
Coverage Report
The above coverage report was generated for the changes in this PR. |
|
Closing this draft. The underlying finding is sound but cannot be landed within the scope of the automated drift correction that produced it. Finding. Across Blocker. These Rather than expand scope, the correction is dropped. The Generated by Claude Code |
Description
This pull request refactors error construction in
@stdlib/utils/library-manifestto use@stdlib/string/format.Refactors
library-manifest's twoTypeErrormessages inlib/main.jsto build via@stdlib/string/formatand%sinstead of string concatenation, matching the pattern used by 141 of the 142 otherutilspackages that construct value-interpolating error messages (99.3%). Message text is preserved byte-for-byte, and existing tests assert only the error type, so behavior is unchanged.@stdlib/string/formatcarries no dependencies, so this introduces no circular dependency.Related Issues
No.
Questions
No.
Other
Identified by a namespace-wide error-construction scan of
utils:library-manifestwas the sole package still assembling interpolated error messages via string concatenation. The line-39 note about avoiding stdlib packages concerns thehasOwnProp/objectKeyshot-path built-ins only;@stdlib/string/formatis dependency-free and the package already requires@stdlib/fs/resolve-parent-pathand@stdlib/utils/convert-path.package.jsonis deliberately left untouched (in-sourcedependenciesare empty namespace-wide and populated at publish time).Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was authored by Claude Code running an automated cross-package drift-detection routine over the
utilsnamespace. The routine extracted the error-construction feature across all 198 members, identifiedlibrary-manifestas the sole value-interpolating concatenation outlier against a 99.3%formatmajority, and validated the fix as behavior-preserving (byte-for-byte identical messages; tests assert error type only) before applying it.@stdlib-js/reviewers
Generated by Claude Code