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

CSHeHu / shoppinglist / 18257008188

05 Oct 2025 09:38AM UTC coverage: 7.187% (-81.7%) from 88.837%
18257008188

push

github

CSHeHu
ci: copy coverage from correct path in container before upload

10 of 24 branches covered (41.67%)

Branch coverage included in aggregate %.

37 of 630 relevant lines covered (5.87%)

0.12 hits per line

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

0.0
/middleware/errorHandler.js
1
import winston from 'winston';
×
2
import path from 'path';
×
3
import { fileURLToPath } from 'url';
×
4

×
5
// __dirname replacement for ESM
×
6
const __filename = fileURLToPath(import.meta.url);
×
7
const __dirname = path.dirname(__filename);
×
8

×
9
const errorLogger = winston.createLogger({
×
10
    level: 'error',
×
11
    format: winston.format.combine(
×
12
        winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }),
×
13
        winston.format.printf(({ timestamp, message, stack, status }) => {
×
14
            return `Timestamp: ${timestamp}\nStatus: ${status}\nMessage: ${message}\nStack: ${stack}\n`;
×
15
        })
×
16
    ),
×
17
    transports: [
×
18
        new winston.transports.File({ filename: path.join(__dirname, '../error.log') }),
×
19
    ],
×
20
});
×
21

×
22
export default function errorHandler(err, req, res, next) {
×
23
    const status = err.status || 500;
×
24

×
25
    // Always log error details
×
26
    errorLogger.error({
×
27
        message: err.message,
×
28
        stack: err.stack,
×
29
        status,
×
30
        timestamp: new Date().toISOString(),
×
31
    });
×
32

×
33
    // Send response (hide details in production)
×
34
    res.status(status).json({
×
35
        error: {
×
36
            code: status,
×
37
            message:
×
38
                req.app.get('env') === 'development'
×
39
                    ? err.message
×
40
                    : 'Something went wrong. Please try again later.',
×
41
        },
×
42
    });
×
43
}
×
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