mirror of
https://github.com/linuxserver/heimdalljs.git
synced 2026-02-20 05:12:24 +08:00
12 lines
222 B
JavaScript
12 lines
222 B
JavaScript
'use strict'
|
|
|
|
/**
|
|
* This is middleware to catch and handle promise errors
|
|
* from our async functions.
|
|
*/
|
|
module.exports = fn => {
|
|
return (req, res, next) => {
|
|
Promise.resolve(fn(req, res, next)).catch(next)
|
|
}
|
|
}
|