Postbote
Concepts

Errors and Safety

Handle normalized failures and understand Postbote's input protections.

Every failure exposed by Postbote is a branded PostboteError. Check it with isPostboteError() rather than instanceof, which remains reliable across package boundaries.

src/emails/send-welcome.ts
import { isPostboteError } from "@postbote/core";

try {
  await mailer.send(message);
} catch (error) {
  if (isPostboteError(error) && error.retryable) {
    // Queue or retry according to your application policy.
  }
  throw error;
}
CodeRetryable by defaultMeaning
ABORTEDNoThe AbortSignal was aborted
AUTHNoProvider authentication failed
CANCELLEDNoA hooks plugin cancelled the send
INVALID_MESSAGENoMessage validation or rendering failed
RECIPIENT_REJECTEDNoThe provider rejected a recipient
RATE_LIMITEDYesThe provider rate-limited the request
PROVIDER_UNAVAILABLEYesProvider or network unavailable
TIMEOUTYesRequest timed out
UNKNOWNNoAn unmapped error occurred

CRLF protection

Before a message is sent, Postbote rejects carriage returns and line feeds in subject, header names and values, and address display names. This prevents email-header injection at the SDK boundary.

Secret redaction

Official adapters map errors without copying request headers or API keys into PostboteError.cause. Keep the same rule in custom adapters.

On this page