]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/async.ts
Add live and viewers otel metrics
[github/Chocobozzz/PeerTube.git] / server / middlewares / async.ts
index 3a1bdabb8a50ec8d44ddd4f2ce0a19035977b0f4..9d01935366725ac3b5d28a20b37c5f1152507939 100644 (file)
@@ -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)
     }