X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmiddlewares%2Fasync.ts;h=9d01935366725ac3b5d28a20b37c5f1152507939;hb=adc94cf09c86112051f72055852efcc977e4a04a;hp=3a1bdabb8a50ec8d44ddd4f2ce0a19035977b0f4;hpb=ba5a8d89bbf049e4afc41543bcc072cccdb02669;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/middlewares/async.ts b/server/middlewares/async.ts index 3a1bdabb8..9d0193536 100644 --- a/server/middlewares/async.ts +++ b/server/middlewares/async.ts @@ -1,7 +1,7 @@ import { eachSeries } from 'async' import { NextFunction, Request, RequestHandler, Response } from 'express' import { ValidationChain } from 'express-validator' -import { ExpressPromiseHandler } from '@server/types/express' +import { ExpressPromiseHandler } from '@server/types/express-handler' import { retryTransactionWrapper } from '../helpers/database-utils' // Syntactic sugar to avoid try/catch in express controllers @@ -13,7 +13,7 @@ function asyncMiddleware (fun: RequestPromiseHandler | RequestPromiseHandler[]) return (req: Request, res: Response, next: NextFunction) => { if (Array.isArray(fun) === true) { return eachSeries(fun as RequestHandler[], (f, cb) => { - Promise.resolve(f(req, res, cb)) + Promise.resolve(f(req, res, err => cb(err))) .catch(err => next(err)) }, next) }