bpms_site/.svn/pristine/04/04e8a9f07a5f4eb0b9f7c40825c9e672d85e1692.svn-base
2025-11-02 16:38:49 +03:30

21 lines
957 B
Plaintext

import { isNotFoundError } from "../../../../../client/components/not-found";
import { getURLFromRedirectError, isRedirectError } from "../../../../../client/components/redirect";
import { handleNotFoundResponse, handleTemporaryRedirectResponse } from "../../helpers/response-handlers";
export function resolveHandlerError(err) {
if (isRedirectError(err)) {
const redirect = getURLFromRedirectError(err);
if (!redirect) {
throw new Error("Invariant: Unexpected redirect url format");
}
// This is a redirect error! Send the redirect response.
return handleTemporaryRedirectResponse(redirect, err.mutableCookies);
}
if (isNotFoundError(err)) {
// This is a not found error! Send the not found response.
return handleNotFoundResponse();
}
// Return false to indicate that this is not a handled error.
return false;
}
//# sourceMappingURL=resolve-handler-error.js.map