Skip to content

Commit c7bbb3d

Browse files
committed
fix: request/response errors never return
1 parent 3e5762e commit c7bbb3d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ const getHostingType = () => getEnv().hostingType || 'localhost'
7373
const fnToPromise = fn => (req, res) => new Promise((onSuccess, onFailure) => {
7474
try {
7575
if (fn.length < 3)
76-
Promise.resolve(fn(req, res)).then(() => onSuccess())
76+
Promise.resolve(fn(req, res))
77+
.then(() => onSuccess())
78+
.catch(err => {
79+
onFailure(err)
80+
})
7781
else
7882
fn(req, res, onSuccess)
7983
}

0 commit comments

Comments
 (0)