Skip to content

feat(errors): add DomainError foundation - #342

Open
jyecusch wants to merge 3 commits into
mainfrom
domain-error
Open

jyecusch wants to merge 3 commits into
mainfrom
domain-error

Conversation

@jyecusch

@jyecusch jyecusch commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Closes SUGA-1976.

Adds @sugabots/errors, which core, the HTTP contracts and any later interface build on. Every expected failure is its own DomainError class with an internal message, a userMessage, isRetryable, an optional retryAfter, and a severity. PublicError is the part of it that may leave the system. asHttpError now nests it in API failures as error.

UserText is the one kind of text for people. userText is how it's written; it takes literals, numbers, fixed sets of words and DisplayNames, and refuses any other string. API failures now take message: UserText, so a route can't send an exception's or a service's text. The 404 for an unknown route no longer echoes the URL. UserMessage in core is now UserText under its old name, until every error is a DomainError. The remaining vouch is UserText.unchecked for better-auth's refusals in the SDK.

Code that has moved is checked by the Effect language service rules raised to errors in tsconfig.base.json, and by the GritQL rules in lint/. bun run lint fails if the two allowlists differ. Today they list only server/src/http/errors.ts; SUGA-1977 adds the model providers first.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
sugabots-website c594897 Oct 08 2026, 11:44 PM

@jyecusch
jyecusch added this pull request to stack #343 October 8, 2026 05:01
Base automatically changed from dockerfile-package-globs to main October 8, 2026 21:36
Comment thread packages/errors/src/index.ts
@jyecusch
jyecusch requested a review from tjholm October 8, 2026 23:22
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