UNPKG

turtle-express

Version:

`turtle-express` is kinda a framework or a library based on `express.js` with an opinionated express router with type safety and schema validation with zod. Also many [more features](https://github.com/mm-ninja-turtles/turtle-express/discussions/7) planni

14 lines (12 loc) 299 B
import type { ErrorRequestHandler } from 'express' export const errorHandler: ErrorRequestHandler = (err, req, res, next) => { if (err instanceof Error) { res.status(500) return res.send({ success: false, message: 'Something went wrong!', data: null, error: err.message, }) } }