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

CSHeHu / shoppinglist / 20435517160

22 Dec 2025 02:58PM UTC coverage: 46.935% (-37.2%) from 84.184%
20435517160

push

github

CSHeHu
remove debug print, add continue on error for tests on CI, fix auth based errors in tests

14 of 22 branches covered (63.64%)

Branch coverage included in aggregate %.

231 of 500 relevant lines covered (46.2%)

0.46 hits per line

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

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

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

1✔
9
const errorLogger = winston.createLogger({
1✔
10
    level: 'error',
1✔
11
    format: winston.format.combine(
1✔
12
        winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }),
1✔
13
        winston.format.json()
1✔
14
    ),
1✔
15
    transports: [
1✔
16
        new winston.transports.File({ filename: path.join(__dirname, '../error.log'), maxsize: 5 * 1024 * 1024, maxFiles: 5 }),
1✔
17
    ],
1✔
18
});
1✔
19

1✔
20
export default function errorHandler(err, req, res, next) {
1✔
21
    const status = err.status || 500;
×
22

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

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