-
-
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: turn redirect
and error
into commands. Export helpers for identifying them when caught
#11165
breaking: turn redirect
and error
into commands. Export helpers for identifying them when caught
#11165
Conversation
🦋 Changeset detectedLatest commit: 171d25c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
d4c3a3b
to
1efdc9e
Compare
redirect
and error
into commands, export helpers for identifying them when caughtredirect
and error
into commands. Export helpers for identifying them when caught
Yeah... I just tried this and it's not working. Adding the @throw tags might have broken it once and for all 😅 |
It's strange because the Curiously, the /**
* Throws an error with a HTTP status code and an optional message.
* When called during request handling, this will cause SvelteKit to
* return an error response without invoking `handleError`.
* Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it.
* @param status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599.
* @param body An object that conforms to the App.Error type. If a string is passed, it will be used as the message property.
* @throws This error instructs SvelteKit to initiate HTTP error handling.
* @throws If the provided status is invalid (not between 400 and 599).
*/ |
Should we just revert the |
Another alternative is to wrap the type in backticks until it gets fixed. - @throws {HttpError} This error instructs SvelteKit to initiate HTTP error handling.
+ @throws `HttpError` This error instructs SvelteKit to initiate HTTP error handling. It's also a bit strange that the overload generates duplicate documentation like this with the same href https://kit-svelte-na0lymp17-svelte.vercel.app/docs/modules#sveltejs-kit-error |
db676ef
to
b2b1b02
Compare
It looks like this PR got corrupted with other changes included on it. It's deleting a few changesets and has other changes that I don't think should be included |
I fixed the |
Closes #11144
Closes #6009
Closes #11186
This makes
redirect
anderror
into functions that returnnever
, meaning we can throw errors from inside of them without making our users do it.This also adds
isHttpError
andisRedirect
helpers to identify these commands if you've caught them -- for example: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:
.