ERROR_CODES (src/errors.ts)

nodemailer · src/errors.ts · typescript · MIT
email

Centralized Nodemailer error code definitions and helpers.

// Source: https://github.com/nodemailer/nodemailer | License: MIT | Copyright 2011-2023 Andris Reinman
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Nodemailer Error Codes
 *
 * Centralized error code definitions for consistent error handling.
 *
 * Usage:
 *   import * as errors from './errors.js';
 *   const err: NodemailerError = new Error('Connection closed');
 *   err.code = errors.ECONNECTION;
 */

/**
 * Error code descriptions for documentation and debugging
 */
export const ERROR_CODES = {
    // Connection errors
    ECONNECTION: 'Connection closed unexpectedly',
    ETIMEDOUT: 'Connection or operation timed out',
    ESOCKET: 'Socket-level error',
    EDNS: 'DNS resolution failed',

    // TLS/Security errors
    ETLS: 'TLS handshake or STARTTLS failed

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key