Errors with Next.js itself now cause 500 errors instead of 503 errors.
This commit is contained in:
parent
6120969910
commit
c01e142031
1 changed files with 3 additions and 4 deletions
7
index.js
7
index.js
|
@ -6,7 +6,6 @@ var dev = process.env.NODE_ENV == "development";
|
|||
var handle = function () {
|
||||
throw nextError;
|
||||
}
|
||||
var appPreparationError = null;
|
||||
var isPrepared = false;
|
||||
var configJSON = {};
|
||||
|
||||
|
@ -49,7 +48,7 @@ try {
|
|||
handle = initResponse[0];
|
||||
isPrepared = true;
|
||||
} catch (err) {
|
||||
appPreparationError = err;
|
||||
nextError = err;
|
||||
}
|
||||
}
|
||||
init();
|
||||
|
@ -77,7 +76,7 @@ try {
|
|||
app.prepare().then(function () {
|
||||
isPrepared = true;
|
||||
}).catch(function (err) {
|
||||
appPreparationError = err;
|
||||
nextError = err;
|
||||
});
|
||||
} catch (err) {
|
||||
nextError = err;
|
||||
|
@ -89,7 +88,7 @@ function Mod() {}
|
|||
Mod.prototype.callback = function callback(req, res, serverconsole, responseEnd, href, ext, uobject, search, defaultpage, users, page404, head, foot, fd, elseCallback, configJSON, callServerError, getCustomHeaders, origHref, redirect, parsePostData) {
|
||||
return async function () {
|
||||
try {
|
||||
if (appPreparationError) throw appPreparationError;
|
||||
if (nextError) throw nextError;
|
||||
if (!isPrepared) {
|
||||
callServerError(503, "nextjs-integration/1.0.0");
|
||||
serverconsole.errmessage("Next.js application not yet fully loaded.");
|
||||
|
|
Loading…
Reference in a new issue