31 lines
1.2 KiB
Plaintext
31 lines
1.2 KiB
Plaintext
"use strict";
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
Object.defineProperty(exports, "resolveHandlerError", {
|
|
enumerable: true,
|
|
get: function() {
|
|
return resolveHandlerError;
|
|
}
|
|
});
|
|
const _notfound = require("../../../../../client/components/not-found");
|
|
const _redirect = require("../../../../../client/components/redirect");
|
|
const _responsehandlers = require("../../helpers/response-handlers");
|
|
function resolveHandlerError(err) {
|
|
if ((0, _redirect.isRedirectError)(err)) {
|
|
const redirect = (0, _redirect.getURLFromRedirectError)(err);
|
|
if (!redirect) {
|
|
throw new Error("Invariant: Unexpected redirect url format");
|
|
}
|
|
// This is a redirect error! Send the redirect response.
|
|
return (0, _responsehandlers.handleTemporaryRedirectResponse)(redirect, err.mutableCookies);
|
|
}
|
|
if ((0, _notfound.isNotFoundError)(err)) {
|
|
// This is a not found error! Send the not found response.
|
|
return (0, _responsehandlers.handleNotFoundResponse)();
|
|
}
|
|
// Return false to indicate that this is not a handled error.
|
|
return false;
|
|
}
|
|
|
|
//# sourceMappingURL=resolve-handler-error.js.map |