ErrorAnalysis
File: error-analysis.interface.ts
Introduction
The ErrorAnalysis
interface is a key component of the error-enhanced
library. It aims to provide in-depth error analysis, capturing the original error, stack frames, and more. The detailed data gathered through this interface can be highly beneficial for debugging and root cause analysis.
Properties
originalError
Error | null
A read-only property representing the original error object, if available.
parsedStack
Array<StackFrame>
A read-only array containing the parsed stack frames from the original error.
Methods
setOriginalError(originalError: Error)
this
Sets the original error object and triggers the extraction of the stack frames. Allows for method chaining.
Example Usage
Best Practices
Use
setOriginalError
to set the original error object, which also populatesparsedStack
for better root cause analysis.Inspect properties like
originalError
andparsedStack
for a comprehensive understanding of the error event.
Conclusion
The ErrorAnalysis
interface offers a structured approach to capture in-depth error diagnostics. It is an essential component for effective error management and debugging.