unit testing for interface
Some checks failed
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Failing after 56s
Some checks failed
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Failing after 56s
This commit is contained in:
@@ -120,7 +120,7 @@ app.use('/api/users', userRouter);
|
||||
// --- Error Handling and Server Startup ---
|
||||
|
||||
// Basic error handling middleware
|
||||
app.use((err: Error, req: Request, res: Response, next: NextFunction) => {
|
||||
app.use((err: Error, req: Request, res: Response, _next: NextFunction) => {
|
||||
// Check if the error is from the timeout middleware
|
||||
if (req.timedout) {
|
||||
// The timeout event is already logged by the requestLogger, but we can add more detail here if needed.
|
||||
@@ -128,9 +128,8 @@ app.use((err: Error, req: Request, res: Response, next: NextFunction) => {
|
||||
return;
|
||||
}
|
||||
logger.error('Unhandled application error:', { error: err.stack, path: req.originalUrl });
|
||||
// The 'next' parameter is required for Express to identify this as an error-handling middleware.
|
||||
// We log it here to satisfy the 'no-unused-vars' lint rule, as it's not called in this terminal handler.
|
||||
// logger.info('Terminal error handler invoked. The "next" function is part of the required signature.', { next: String(next) });
|
||||
// The 4-argument signature is required for Express to identify this as an error-handling middleware.
|
||||
// We prefix `next` with an underscore to indicate it's intentionally unused, satisfying the linter.
|
||||
if (!res.headersSent) {
|
||||
res.status(500).json({ message: 'Something broke!' });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user