• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

statuscompliance / status-backend / 15136709988

20 May 2025 11:48AM UTC coverage: 54.282% (+1.0%) from 53.287%
15136709988

Pull #198

github

web-flow
Merge d6182d82e into f5cbd38d9
Pull Request #198: chore(logger): implement winston logging system

417 of 886 branches covered (47.07%)

Branch coverage included in aggregate %.

113 of 145 new or added lines in 6 files covered. (77.93%)

1 existing line in 1 file now uncovered.

1060 of 1835 relevant lines covered (57.77%)

10.41 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

5.56
/src/middleware/errorHandler.js
1
import { logError } from '../config/logger.js';
2

3
export const errorHandler = (err, req, res) => {
27✔
NEW
4
  const statusCode = err.statusCode || 500;
×
5
  
6
  // Extract relevant information for error logging
NEW
7
  const errorInfo = {
×
8
    requestId: req.requestId,
9
    userId: req.user?.id || 'anonymous',
×
10
    ip: req.ip || req.headers['x-forwarded-for'] || req.socket.remoteAddress,
×
11
    url: req.originalUrl,
12
    method: req.method,
13
    statusCode: statusCode,
14
    functionName: err.functionName || '',
×
15
    lineNumber: err.lineNumber || 0,
×
16
  };
17
  
18
  // Log the error
NEW
19
  logError(err, errorInfo);
×
20
  
21
  // Respond to the client
NEW
22
  res.status(statusCode).json({
×
23
    status: 'error',
24
    message: process.env.NODE_ENV === 'production' 
×
25
      ? 'An error occurred on the server' 
26
      : err.message,
27
    requestId: req.requestId, // Include the request ID so the client can report it
28
  });
29
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc