...
|
...
|
@@ -6,7 +6,7 @@ const headerModel = require('../models/header'); |
|
|
const logger = require('../../library/logger');
|
|
|
|
|
|
exports.notFound = () => {
|
|
|
return (req, res) => {
|
|
|
return (req, res, next) => {
|
|
|
if (req.xhr) {
|
|
|
return res.status(404).json({
|
|
|
code: 404,
|
...
|
...
|
@@ -21,7 +21,7 @@ exports.notFound = () => { |
|
|
title: '页面不存在 | Yoho!Buy有货 | 潮流购物逛不停',
|
|
|
headerData: result.headerData
|
|
|
});
|
|
|
});
|
|
|
}).catch(next);
|
|
|
|
|
|
};
|
|
|
};
|
...
|
...
|
@@ -32,6 +32,7 @@ exports.notFound = () => { |
|
|
*/
|
|
|
exports.serverError = () => {
|
|
|
return (err, req, res, next) => {
|
|
|
logger.error(err);
|
|
|
if (!res.headersSent) {
|
|
|
if (req.xhr) {
|
|
|
return res.status(500).json({
|
...
|
...
|
@@ -40,8 +41,7 @@ exports.serverError = () => { |
|
|
});
|
|
|
}
|
|
|
|
|
|
logger.error(err);
|
|
|
headerModel.requestHeaderData().then((result) => {
|
|
|
return headerModel.requestHeaderData().then((result) => {
|
|
|
return res.render('error/500', {
|
|
|
module: 'common',
|
|
|
page: 'error',
|
...
|
...
|
|