23 lines
666 B
JavaScript
23 lines
666 B
JavaScript
export { AuthRoutes } from "./AuthRoutes"
|
|
export { AssetRoutes } from "./AssetRoutes"
|
|
export { UserRoutes } from "./UserRoutes"
|
|
export { WorkItemRoutes } from "./WorkItemRoutes"
|
|
export { ActivityRoutes } from "./ActivityRoutes"
|
|
export { TeamRoutes } from "./TeamRoutes"
|
|
export { SystemRoutes } from "./SystemRoutes"
|
|
import createError from "http-errors"
|
|
|
|
export function catchAll(routeHandler) {
|
|
return async (req, res, next) => {
|
|
try {
|
|
await routeHandler(req, res, next)
|
|
} catch (err) {
|
|
if (err instanceof createError.HttpError) {
|
|
next(err)
|
|
} else {
|
|
next(createError.InternalServerError(err.message))
|
|
}
|
|
}
|
|
}
|
|
}
|