export const errorHandler = (err, req, res, next) => { // eslint-disable-next-line no-console console.error('Hata:', err); const status = err.status || 500; const code = err.code || 'INTERNAL_ERROR'; const message = err.message || 'Sunucu hatası'; const response = { error: { code, message } }; if (err.details) { response.error.details = err.details; } return res.status(status).json(response); };