Reference

Errors

Handle stable sently error codes and provider-specific error instances.

All library transport and protocol failures derive from SentlyError; use sentlyCode for stable handling.

import { SentlyError } from "sently/errors";

try {
  await mailer.send(message);
} catch (error) {
  if (error instanceof SentlyError) console.error(error.sentlyCode);
}

Provider error classes also retain provider response details where their transport exposes them.

sentlyCodeWhen
TIMEOUTConnect, greeting, reply, or HTTP deadline elapsed
TLS_FAILEDCertificate failure, or STARTTLS required but unavailable
TRANSIENTSMTP 421, 450, or 451 (permanent is false)
CONNECTION_FAILEDRefused, unreachable, or DNS failure
INVALID_CONFIGMissing recipient, header injection, or empty SMTP password

JSON.stringify on SentlyError omits the raw SMTP reply. Log sentlyCode, command, and statusCode.