Performance: Custom error classes
LOW IMPACT
This affects the error handling flow and stack trace generation during runtime, impacting debugging speed and error reporting performance.
class FetchError extends Error { constructor(message) { super(message); this.name = 'FetchError'; } } function fetchData() { throw new FetchError('Failed to fetch data'); }
function fetchData() {
throw new Error('Failed to fetch data');
}| Pattern | Runtime Overhead | Stack Trace Clarity | Debugging Speed | Verdict |
|---|---|---|---|---|
| Generic Error | Minimal | Low (generic message) | Slower due to unclear error type | [!] OK |
| Custom Error Class | Minimal | High (specific error name) | Faster due to clear error type | [OK] Good |