docs: document error-class selection guidelines - #7279
Merged
bartlomieju merged 3 commits intoAug 3, 2026
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7279 +/- ##
==========================================
- Coverage 95.03% 95.03% -0.01%
==========================================
Files 618 618
Lines 51598 51850 +252
Branches 9345 9394 +49
==========================================
+ Hits 49036 49275 +239
- Misses 2021 2030 +9
- Partials 541 545 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
bartlomieju
reviewed
Aug 3, 2026
|
|
||
| Exception: `@std/assert` uses periods in error messages (downstream compat). | ||
|
|
||
| ## Error Classes |
Member
There was a problem hiding this comment.
A bit wary of the duplication - maybe AGENTS.md could reference the CONTRIBUTING.md?
Contributor
Author
There was a problem hiding this comment.
Fair, done. Now a reference. Fwiw the Error Message Style section above duplicates CONTRIBUTING.md the same way, so I can convert that one too in a follow-up if you want AGENTS.md to be pointers rather than copies.
Member
There was a problem hiding this comment.
That would be great, thanks!
bartlomieju
approved these changes
Aug 3, 2026
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 writes down the error-class doctrine that #5340 established but CONTRIBUTING.md never captured: which built-in to throw, when to subclass one, and when a custom class is justified. AGENTS.md gets the condensed version, next to the message-style rules it already mirrors.
Nothing here is invented. It comes from a
throw newsurvey of main (tests excluded):TypeErrorfor wrong argument type or shape: http 55, cbor 21, data-structures 15RangeErrorfor out-of-range values: cbor 33, async 15, encoding 12SyntaxErrorfor unparsable textual input: http 59, toml 21, csv 10, jsonc 10, ini 5. Established by the suggestion: replaceYamlErrorwith native errors #5340 campaign (BREAKING(yaml): replaceYamlErrorwithSyntaxErrorinparse()#5446, BREAKING(yaml): replaceYamlErrorwithTypeErrorinstringify()#5452, BREAKING(csv): throwTypeErrorinstringify()instead ofStringifyError#5347, BREAKING(toml): throwSyntaxErrorinparse()instead ofTOMLParseError#5346) to alignparse()functions withJSON.parse()XmlSyntaxError(BREAKING(xml): clean up public API #7233),YamlSyntaxError(feat(yaml): introduceYamlSyntaxErrorwith structured position info #7235)RetryError,ChannelClosedError,CircuitBreakerOpenError,MockError,TimeError,HttpErrorPlain
Error(datetime 19, fs 18) andEvalError(msgpack 27) predate the campaign, so the text calls them legacy instead of pretending the tree is uniform.