Update Util.js
This commit is contained in:
parent
6bbd46e7df
commit
1a11c6f396
|
@ -21,7 +21,7 @@ module.exports = class Util {
|
||||||
// eslint-disable-next-line func-names
|
// eslint-disable-next-line func-names
|
||||||
return function(req, res) {
|
return function(req, res) {
|
||||||
Promise.resolve().then(async () => fn(req, res))
|
Promise.resolve().then(async () => fn(req, res))
|
||||||
.then(result => {
|
.then((result) => {
|
||||||
if (res.headersSent) return;
|
if (res.headersSent) return;
|
||||||
|
|
||||||
if (typeof result === 'undefined') {
|
if (typeof result === 'undefined') {
|
||||||
|
@ -34,7 +34,7 @@ module.exports = class Util {
|
||||||
.status(200)
|
.status(200)
|
||||||
.json(result);
|
.json(result);
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch((error) => {
|
||||||
if (typeof error === 'string') {
|
if (typeof error === 'string') {
|
||||||
error = new Error(error);
|
error = new Error(error);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue