Skip to content

Package

errors v0.13.0

Changelog

seedcordseedcord

The whole Discord bot, typed end to end

Website · Guide · Reference · Discord

npm node bun license

About

@seedcord/errors holds every error seedcord throws. Each one carries a registered code from SeedcordErrorCode, so a caller can branch on one specific failure.

Framework code never throws a raw Error. A third-party throw may be translated into one of these before you catch it.

Until v1.0.0, minor versions can break.

Installation

Your transport already re-exports this.

pnpm add @seedcord/errors

Usage

isSeedcordError narrows on the class and the code together:

import { isSeedcordError, SeedcordErrorCode } from '@seedcord/errors';

try {
    await run();
} catch (error) {
    if (isSeedcordError(error, 'SeedcordError', SeedcordErrorCode.CliCancelled)) return;
    throw error;
}

Called with one argument it narrows to any seedcord error.