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.
sentlyCode | When |
|---|---|
TIMEOUT | Connect, greeting, reply, or HTTP deadline elapsed |
TLS_FAILED | Certificate failure, or STARTTLS required but unavailable |
TRANSIENT | SMTP 421, 450, or 451 (permanent is false) |
CONNECTION_FAILED | Refused, unreachable, or DNS failure |
INVALID_CONFIG | Missing recipient, header injection, or empty SMTP password |
JSON.stringify on SentlyError omits the raw SMTP reply. Log sentlyCode, command, and statusCode.