Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 1x 25x 287x | /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import {RequestHandler} from 'express';
/**
* Wrapper for async function. Creates an request handler
* which will call the given RequestHandler and catch
* errors by calling the next function.
* @param fn - Function to wrap
*/
export const asyncWrapper = (fn: RequestHandler): RequestHandler =>
(req, res, next) => {
Promise.resolve(fn(req, res, next)).catch(next);
};
|