instanceof for broad handling, or switch on error.code for precise recovery.
The error hierarchy
Error fields
EveryWhatsAppError carries:
Error codes
ErrorCode
Canonical error codes returned by the server.
ErrorCode
Canonical error codes returned by the server.
code when you want to react to a specific failure mode rather than a whole class:
Retrying
The SDK can retry transient errors automatically. Opt in viaClientOptions.retry:
error.retryable === true. Non-retryable errors (validation failures, auth issues) propagate immediately — don’t wrap them in your own retry loop.
Subscribe vs unary calls
Streaming errors inevents.subscribe() trigger the reconnect machinery rather than throwing — see Events → Reconnection. Errors from unary calls (messages.send, media.upload, events.fetchMissed) throw.