better errors for routes
Some checks failed
Deploy to Test Environment / deploy-to-test (push) Failing after 8m2s
Some checks failed
Deploy to Test Environment / deploy-to-test (push) Failing after 8m2s
This commit is contained in:
@@ -5,6 +5,7 @@ import express, { Request, Response, NextFunction } from 'express';
|
||||
import adminRouter from './admin.routes';
|
||||
import { createMockUserProfile } from '../tests/utils/mockFactories';
|
||||
import { UserProfile } from '../types';
|
||||
import { errorHandler } from '../middleware/errorHandler';
|
||||
|
||||
// Mock dependencies
|
||||
vi.mock('../services/geocodingService.server', () => ({
|
||||
@@ -52,9 +53,7 @@ const createApp = () => {
|
||||
const app = express();
|
||||
app.use(express.json());
|
||||
app.use('/api/admin', adminRouter);
|
||||
app.use((err: Error, req: Request, res: Response, next: NextFunction) => {
|
||||
res.status(500).json({ message: err.message || 'Internal Server Error' });
|
||||
});
|
||||
app.use(errorHandler);
|
||||
return app;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user