discord-webhook-library
Version:
A powerful and easy-to-use library for creating and sending richly formatted messages to Discord webhooks, with built-in validation and rate-limiting.
45 lines (44 loc) • 1.43 kB
TypeScript
import { ZodError } from 'zod';
/**
* Base error class for all custom errors in the Discord Webhook Library.
*/
export interface SendFailureDetail {
webhookUrl: string;
messagePayload?: Record<string, unknown>;
filePath?: string;
error: unknown;
type: 'message' | 'file' | 'info' | 'success' | 'warning' | 'error' | 'delete';
}
/**
* Base error class for all custom errors in the Discord Webhook Library.
*/
export declare class WebhookError extends Error {
code: string;
details?: SendFailureDetail[];
constructor(message: string, code?: string, details?: SendFailureDetail[]);
}
/**
* Error class for validation failures, typically wrapping Zod errors.
*/
export declare class ValidationError extends WebhookError {
issues: ZodError['issues'] | null;
constructor(message: string, issues?: ZodError['issues'] | null);
/**
* Formats Zod issues into a more readable string.
*/
formatIssues(): string;
}
/**
* Error class for issues during HTTP requests to the Discord API.
*/
export declare class RequestError extends WebhookError {
status: number | undefined;
discordMessage: string | undefined;
constructor(message: string, status?: number, discordMessage?: string, code?: string);
}
/**
* Error class for file system related operations.
*/
export declare class FileSystemError extends WebhookError {
constructor(message: string, code?: string);
}