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 () {
|
var handle = function () {
|
||||||
throw nextError;
|
throw nextError;
|
||||||
}
|
}
|
||||||
var appPreparationError = null;
|
|
||||||
var isPrepared = false;
|
var isPrepared = false;
|
||||||
var configJSON = {};
|
var configJSON = {};
|
||||||
|
|
||||||
|
@ -49,7 +48,7 @@ try {
|
||||||
handle = initResponse[0];
|
handle = initResponse[0];
|
||||||
isPrepared = true;
|
isPrepared = true;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
appPreparationError = err;
|
nextError = err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
init();
|
init();
|
||||||
|
@ -77,7 +76,7 @@ try {
|
||||||
app.prepare().then(function () {
|
app.prepare().then(function () {
|
||||||
isPrepared = true;
|
isPrepared = true;
|
||||||
}).catch(function (err) {
|
}).catch(function (err) {
|
||||||
appPreparationError = err;
|
nextError = err;
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
nextError = 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) {
|
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 () {
|
return async function () {
|
||||||
try {
|
try {
|
||||||
if (appPreparationError) throw appPreparationError;
|
if (nextError) throw nextError;
|
||||||
if (!isPrepared) {
|
if (!isPrepared) {
|
||||||
callServerError(503, "nextjs-integration/1.0.0");
|
callServerError(503, "nextjs-integration/1.0.0");
|
||||||
serverconsole.errmessage("Next.js application not yet fully loaded.");
|
serverconsole.errmessage("Next.js application not yet fully loaded.");
|
||||||
|
|
Loading…
Reference in a new issue