Skip to content

docs: document error-class selection guidelines - #7279

Merged
bartlomieju merged 3 commits into
denoland:mainfrom
tomas-zijdemans:docs-error-class-guidelines
Aug 3, 2026
Merged

docs: document error-class selection guidelines#7279
bartlomieju merged 3 commits into
denoland:mainfrom
tomas-zijdemans:docs-error-class-guidelines

Conversation

@tomas-zijdemans

Copy link
Copy Markdown
Contributor

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 new survey of main (tests excluded):

Plain Error (datetime 19, fs 18) and EvalError (msgpack 27) predate the campaign, so the text calls them legacy instead of pretending the tree is uniform.

@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.03%. Comparing base (b847d39) to head (1a4b3ba).
⚠️ Report is 1 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread AGENTS.md

Exception: `@std/assert` uses periods in error messages (downstream compat).

## Error Classes

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit wary of the duplication - maybe AGENTS.md could reference the CONTRIBUTING.md?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be great, thanks!

@bartlomieju
bartlomieju merged commit b780af4 into denoland:main Aug 3, 2026
17 checks passed
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.

2 participants