-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started: Basic Usage
alessbarb edited this page Sep 22, 2023
·
2 revisions
Here's a simple example demonstrating how to create an enhanced error object:
import { ErrorEnhanced, IdentifiersEnhancer, Severity } from 'error-enhanced';
// Instantiate a new enhanced error object
const error = new ErrorEnhanced([
new IdentifiersEnhancer()
]);You can set various properties like the error code and severity level:
error
.setErrorCode(404)
.setSeverity(Severity.HIGH);You can easily retrieve the properties you've set:
console.log(error.id); // Outputs a unique identifier for the error
console.log(error.severity); // Outputs the severity level, e.g., "HIGH"error-enhanced Wiki
Version: 1.2.1 - © 2023
🔗 MIT License | 📦 GitHub Repository | 🐞 Report Issues | ✉️ Contact