Problem:
Errors are manually wrapped, losing important contextual information.
Proposed Solution:
Leverage the cause option in Error to retain the original error context.
TypeScript Version Required: 5.3+
Affected Files:
abortError.ts
apiError.ts
argumentsValidationError.ts
responseValidationError.ts
Example Fix (abortError.ts):
class AbortError extends Error {
constructor(message: string, cause?: unknown) {
super(message, { cause });
this.name = "AbortError";
}
}
Expected Benefits:
- Provides better debugging support with detailed error causality.
- Retains the original error stack trace for improved issue resolution.
Problem:
Errors are manually wrapped, losing important contextual information.
Proposed Solution:
Leverage the
causeoption inErrorto retain the original error context.TypeScript Version Required: 5.3+
Affected Files:
abortError.tsapiError.tsargumentsValidationError.tsresponseValidationError.tsExample Fix (
abortError.ts):Expected Benefits: