UNPKG

@gov-cy/govcy-express-services

Version:

An Express-based system that dynamically renders services using @gov-cy/govcy-frontend-renderer and posts data to a submission API.

13 lines 447 B
/** * Helper function to handle errors in middleware. * Creates an error object and passes it to the next middleware. * * @param {string} message - The error message. * @param {number} status - The HTTP status code. * @param {function} next - The Express `next` function. */ export function handleMiddlewareError(message, status, next) { const error = new Error(message); error.status = status; return next(error); }