import type { Request, Response, NextFunction } from 'express'
import { logger } from '../../config/logger'

export function errorMiddleware(
  err: Error,
  _req: Request,
  res: Response,
  _next: NextFunction
): void {
  logger.error(err, 'Unhandled error')
  res.status(500).json({ error: 'Erro interno do servidor' })
}
