The `custom-exception` package, currently at version 0.1.2, provides a foundational utility for creating custom error classes within Node.js applications. It aims to simplify the process of defining structured, extensible error types beyond the standard JavaScript `Error` object. While still in early development, as indicated by its low version number, it offers a mechanism to differentiate application-specific errors programmatically. Its release cadence is likely irregular, given its nascent stage. Key differentiators typically include boilerplate reduction for custom error inheritance, properties like status codes, and improved stack trace handling, though specifics depend on the full API. Users should anticipate potential API changes as the library evolves towards a stable major release.
npm install custom-exceptionVerified import paths — ran on the pinned version, not inferred.
Demonstrates defining a custom error by extending `CustomError`, adding custom properties, and catching it with `instanceof` checks.
Pin your package version (e.g., `"custom-exception": "0.1.2"`) and manually review the changelog before upgrading to new minor or patch versions.
Add `Object.setPrototypeOf(this, MyCustomError.prototype);` to your custom error class constructor after `super(message);`.
Always set `this.name = 'MyCustomError';` in the constructor of your derived error class to ensure accurate error identification.
Always create instances of `CustomError` or its derivatives using `new`, e.g., `throw new CustomError('message');`.Ensure `Object.setPrototypeOf(this, MyCustomError.prototype);` is called in your custom error's constructor after `super()`.
No dependency data recorded yet.