Performance: Error response formatting
MEDIUM IMPACT
This affects server response time and client rendering speed by controlling payload size and parsing complexity.
res.status(500).json({ error: 'Database failure', code: 'DB_ERR' });
res.status(500).json({ error: err.message, stack: err.stack, data: largeDataObject });| Pattern | Payload Size | Parsing Time | Client Render Delay | Verdict |
|---|---|---|---|---|
| Full error object with stack and data | Large (20-50kb) | High | High (50-100ms delay) | [X] Bad |
| Minimal error message with code | Small (<2kb) | Low | Low (<10ms delay) | [OK] Good |