DeesseJS Errors

Installation

Install @deessejs/errors in your TypeScript or JavaScript project.

Adding @deessejs/errors to your project is straightforward. The library is available on npm and supports all major package managers.

Install the Package

Choose your preferred package manager and run the installation command:

npm install @deessejs/errors
pnpm add @deessejs/errors
yarn add @deessejs/errors
bun add @deessejs/errors

Requirements

@deessejs/errors requires Node.js 18 or later. The library is written in TypeScript and ships with full type definitions, so no additional @types packages are needed.

Import the Library

Once installed, you can import the core functions from the package:

main.ts
import { error, raise, is, causes } from '@deessejs/errors';

You can also import specific functions if you prefer tree-shaking:

partial.ts
import { error } from '@deessejs/errors';
import { is } from '@deessejs/errors';

TypeScript Configuration

The library works out of the box with TypeScript. No special compiler options are required, but the following settings in your tsconfig.json will ensure the best experience:

tsconfig.json
{
  "compilerOptions": {
    "strict": true,
    "moduleResolution": "bundler"
  }
}

The moduleResolution: "bundler" option is recommended if you're using a modern bundler like Vite, webpack 5, or Turbopack.

Verify Installation

To verify that the library is installed correctly, create a simple test file:

verify.ts
import { error } from '@deessejs/errors';

const TestError = error({ name: 'TestError' });
const err = TestError({});

console.log(err.name); // "TestError"
console.log(err instanceof Error); // true

Run this file with Node.js or your bundler to confirm everything works.

See Also

On this page