Peter Lewis
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
2 additions and
2 deletions
-
src/lib/Util.js
|
|
@ -21,7 +21,7 @@ module.exports = class Util { |
|
|
|
// eslint-disable-next-line func-names
|
|
|
|
return function(req, res) { |
|
|
|
Promise.resolve().then(async () => fn(req, res)) |
|
|
|
.then(result => { |
|
|
|
.then((result) => { |
|
|
|
if (res.headersSent) return; |
|
|
|
|
|
|
|
if (typeof result === 'undefined') { |
|
|
@ -34,7 +34,7 @@ module.exports = class Util { |
|
|
|
.status(200) |
|
|
|
.json(result); |
|
|
|
}) |
|
|
|
.catch(error => { |
|
|
|
.catch((error) => { |
|
|
|
if (typeof error === 'string') { |
|
|
|
error = new Error(error); |
|
|
|
} |
|
|
|