21 lines
764 B
JavaScript
21 lines
764 B
JavaScript
const NOT_FOUND_ERROR_CODE = "NEXT_NOT_FOUND";
|
|
/**
|
|
* 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() {
|
|
// eslint-disable-next-line no-throw-literal
|
|
const error = new Error(NOT_FOUND_ERROR_CODE);
|
|
error.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) {
|
|
return (error == null ? void 0 : error.digest) === NOT_FOUND_ERROR_CODE;
|
|
}
|
|
|
|
//# sourceMappingURL=not-found.js.map
|