-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'canary' into wyattjoh/null-navigation-hooks
- Loading branch information
Showing
141 changed files
with
5,223 additions
and
706 deletions.
There are no files selected for viewing
This file contains 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 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,14 @@ | ||
# `NextResponse.next()` used in a App Route Handler | ||
|
||
#### Why This Error Occurred | ||
|
||
App Route Handler's do not currently support using the `NextResponse.next()` method to forward to the next middleware because the handler is considered the endpoint to the middleware chain. Handlers must always return a `Response` object instead. | ||
|
||
#### Possible Ways to Fix It | ||
|
||
Remove the `NextResponse.next()` and replace it with a correct response handler. | ||
|
||
### Useful Links | ||
|
||
- [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) | ||
- [`NextResponse`](https://nextjs.org/docs/api-reference/next/server#nextresponse) |
This file contains 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 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 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 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 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 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 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 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 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 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,8 +1,25 @@ | ||
export const NOT_FOUND_ERROR_CODE = 'NEXT_NOT_FOUND' | ||
const NOT_FOUND_ERROR_CODE = 'NEXT_NOT_FOUND' | ||
|
||
type NotFoundError = Error & { digest: typeof NOT_FOUND_ERROR_CODE } | ||
|
||
/** | ||
* When used in a React server component, this will set the status code to 404. | ||
* When used in a custom app route it will just send a 404 status. | ||
*/ | ||
export function notFound(): never { | ||
// eslint-disable-next-line no-throw-literal | ||
const error = new Error(NOT_FOUND_ERROR_CODE) | ||
;(error as any).digest = NOT_FOUND_ERROR_CODE | ||
;(error as NotFoundError).digest = NOT_FOUND_ERROR_CODE | ||
throw error | ||
} | ||
|
||
/** | ||
* Checks an error to determine if it's an error generated by the `notFound()` | ||
* helper. | ||
* | ||
* @param error the error that may reference a not found error | ||
* @returns true if the error is a not found error | ||
*/ | ||
export function isNotFoundError(error: any): error is NotFoundError { | ||
return error?.digest === NOT_FOUND_ERROR_CODE | ||
} |
Oops, something went wrong.