import * as express from 'express' ; import * as signale from 'signale' ; import CustomError from '../helpers/customError' ; import config from '../config' ; export const send = async ( error , _req , res , _next ) => { const message = error instanceof CustomError ? error . message : 'An error occurred.' ; if ( config . is_dev ) signale . fatal ( error ) ; res . status ( 422 ) . json ( { error : message } ) ; } ; export const notFound = async ( _req , res ) => res . status ( 404 ) . json ( { message : 'Not found.' } ) ;