-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Create helper function for ui errors
- Loading branch information
1 parent
37376b0
commit c3baf8b
Showing
6 changed files
with
52 additions
and
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,8 @@ | ||
import { isNotFoundError } from './not-found' | ||
import { isRedirectError } from './redirect' | ||
import { isForbiddenError } from './forbidden' | ||
import { matchUIError } from '../../shared/lib/ui-error-types' | ||
|
||
export function isNextRouterError(error: any): boolean { | ||
return ( | ||
error && | ||
error.digest && | ||
(isRedirectError(error) || | ||
isNotFoundError(error) || | ||
isForbiddenError(error)) | ||
error && error.digest && (isRedirectError(error) || !!matchUIError(error)) | ||
) | ||
} |
5 changes: 2 additions & 3 deletions
5
packages/next/src/export/helpers/is-navigation-signal-error.ts
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,11 +1,10 @@ | ||
import { isNotFoundError } from '../../client/components/not-found' | ||
import { isRedirectError } from '../../client/components/redirect' | ||
import { isForbiddenError } from '../../client/components/forbidden' | ||
import { matchUIError } from '../../shared/lib/ui-error-types' | ||
|
||
/** | ||
* Returns true if the error is a navigation signal error. These errors are | ||
* thrown by user code to perform navigation operations and interrupt the React | ||
* render. | ||
*/ | ||
export const isNavigationSignalError = (err: unknown) => | ||
isNotFoundError(err) || isRedirectError(err) || isForbiddenError(err) | ||
isRedirectError(err) || !!matchUIError(err) |
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