-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
breaking: turn redirect and error into commands. Export helpers for identifying them when caught
#11165
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
Merged
Rich-Harris
merged 38 commits into
version-2
from
elliott/kit-command-error-improvements
Dec 11, 2023
Merged
breaking: turn redirect and error into commands. Export helpers for identifying them when caught
#11165
Changes from 7 commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
cfeade1
feat: Do the things
elliott-with-the-longest-name-on-github 0f06fd1
changeset
elliott-with-the-longest-name-on-github 20be7b5
better
elliott-with-the-longest-name-on-github 3f5ae76
fix: types
elliott-with-the-longest-name-on-github d1920a2
feat: Replace `throw redirect` with `redirect`
elliott-with-the-longest-name-on-github 1efdc9e
feat: Replace `throw error` with `error`
elliott-with-the-longest-name-on-github e12d34d
fix: Revert changes to migrations
elliott-with-the-longest-name-on-github 017a494
fix: Internals
elliott-with-the-longest-name-on-github b07797f
Update .changeset/clean-cars-kiss.md
elliott-with-the-longest-name-on-github 764e9e3
fix: lint
elliott-with-the-longest-name-on-github 3df53ab
Merge branch 'elliott/kit-command-error-improvements' of github.com:s…
elliott-with-the-longest-name-on-github 77ab3bb
Merge branch 'version-2' into elliott/kit-command-error-improvements
benmccann 1588f50
Merge branch 'version-2' into elliott/kit-command-error-improvements
benmccann daf4d7a
fix jsdoc overload function description
teemingc 0be2b5a
oops accidentally overwrote these while experimenting
teemingc 3e6be33
Merge branch 'version-2' into elliott/kit-command-error-improvements
benmccann 53ac369
Merge branch 'version-2' into elliott/kit-command-error-improvements
benmccann efffd3d
feat: Do the things
elliott-with-the-longest-name-on-github 8e2a89e
changeset
elliott-with-the-longest-name-on-github ed210ba
better
elliott-with-the-longest-name-on-github e7d5295
fix: types
elliott-with-the-longest-name-on-github 15dcd3e
feat: Replace `throw redirect` with `redirect`
elliott-with-the-longest-name-on-github 4d1eb74
feat: Replace `throw error` with `error`
elliott-with-the-longest-name-on-github e534718
fix: Revert changes to migrations
elliott-with-the-longest-name-on-github 862c8b0
fix: Internals
elliott-with-the-longest-name-on-github d0f5413
fix: lint
elliott-with-the-longest-name-on-github 97b1828
Update .changeset/clean-cars-kiss.md
elliott-with-the-longest-name-on-github aa1c0a1
feat: Document errors thrown by error and redirect, add fancy numeric…
elliott-with-the-longest-name-on-github cf32083
Merge branch 'elliott/kit-command-error-improvements' of github.com:s…
elliott-with-the-longest-name-on-github e1bbc16
fix: meh
elliott-with-the-longest-name-on-github ea0747c
fix: type
elliott-with-the-longest-name-on-github b2b1b02
fix overloaded error method jsdocs
teemingc 78763e3
merge version-2
Rich-Harris c93158e
tweak docs
Rich-Harris f84b2d4
tweak implementation
Rich-Harris dcf3c95
Merge branch 'version-2' into elliott/kit-command-error-improvements
Rich-Harris fcc4570
Merge branch 'version-2' into elliott/kit-command-error-improvements
Rich-Harris 171d25c
update types
Rich-Harris File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@sveltejs/kit': major | ||
| --- | ||
|
|
||
| breaking: Turn `error` and `redirect` into commands | ||
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import { redirect } from '@sveltejs/kit'; | ||
|
|
||
| export function load() { | ||
| throw redirect(307, encodeURI('苗条')); | ||
| redirect(307, encodeURI('苗条')); | ||
| } |
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
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
2 changes: 1 addition & 1 deletion
2
packages/kit/test/apps/basics/src/routes/errors/endpoint-throw-error/+server.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import { error } from '@sveltejs/kit'; | ||
|
|
||
| export function GET() { | ||
| throw error(401, 'You shall not pass'); | ||
| error(401, 'You shall not pass'); | ||
| } |
2 changes: 1 addition & 1 deletion
2
packages/kit/test/apps/basics/src/routes/errors/endpoint-throw-redirect/+server.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import { redirect } from '@sveltejs/kit'; | ||
|
|
||
| export function GET() { | ||
| throw redirect(302, '/'); | ||
| redirect(302, '/'); | ||
| } |
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
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
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
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
2 changes: 1 addition & 1 deletion
2
packages/kit/test/apps/basics/src/routes/errors/page-endpoint/get-explicit/+page.server.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import { error } from '@sveltejs/kit'; | ||
|
|
||
| export const load = () => { | ||
| throw error(400, 'oops'); | ||
| error(400, 'oops'); | ||
| }; |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.