-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
breaking: tighten up error handling #11289
Conversation
Introduces a NonFatalError object that is used internally and that is user-detectable in handleError
🦋 Changeset detectedLatest commit: 231f212 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Instead of introducing a export function handleError({ error, status, message }) {
const id = crypto.randomUUID();
report(id, error);
return {
id,
message // e.g. 'Not Found' for things we threw ourselves, 'Internal Error' for unexpected stuff (as today)
};
} |
We still need the class internally to distinguish it before passing it to |
Was the try-catch really only applied because of the known throw inside, or was it a "who knows let's better be extra safe" precaution? |
Because of the known throw inside. It's a bad practice to wrap code that can't error |
Introduces
status
andmessage
tohandleError
which default to500
and"Internal Error"
. Introduces a NonFatalError object that is used internally and is used to convert to more specificstatus
/message
objects. It's used everywhere where we can reasonably assign a non-500 status code.closes #11287
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. Changesets that add features should beminor
and those that fix bugs should bepatch
. Please prefix changeset messages withfeat:
,fix:
, orchore:
.