check-error is a JavaScript utility library designed for robust error inspection and comparison in both Node.js and browser environments. Currently at stable version 2.1.3, it provides functions to retrieve error information, such as constructor names and messages, and to determine compatibility between errors based on their instance, constructor, or message content. It is a foundational utility often employed within testing frameworks, particularly Chai, for asserting error conditions. Since version 2.0.0, it is an ESM-only module, requiring modern JavaScript environments (Node.js 16+, Firefox 102+, Chromium Edge+). Releases are infrequent, focusing on maintenance and modernizing the codebase to align with current JavaScript standards. Its key differentiator is providing a standardized set of primitives for error interrogation, abstracted away from environment-specific quirks, which simplifies error handling logic across different contexts. This ensures consistent behavior when dealing with various types of errors and their properties.
npm install check-errorVerified import paths — ran on the pinned version, not inferred.
Demonstrates catching different error types and using `check-error` to inspect their constructor names, messages, and compatibility with other error types.
Migrate your project to use ESM `import` syntax. Ensure your Node.js environment is v16 or higher, or use modern browsers (Firefox 102+, Chromium Edge+).
Upgrade your environment to meet the minimum requirements (Node.js >=16, Firefox >=102, Chromium Edge/Chrome/Safari latest).
Upgrade to version 2.1.2 or newer to ensure robust handling of invalid inputs in message comparisons.
Change `const checkError = require('check-error');` to `import * as checkError from 'check-error';` and ensure your project is configured for ESM (e.g., `"type": "module"` in package.json).Verify that `checkError` is correctly imported as `import * as checkError from 'check-error';` and that the method name (`compatibleMessage` or others) is spelled correctly and exists in the current version of the library.
No dependency data recorded yet.