Result handling
Every method returns a discriminated union; the SDK catches network, JSON, and HTTP errors internally:
type EmailSdkResult<T> = | { data: T; error: null } | { data: null; error: SdkError };So no try/catch around SDK calls — check error and narrow:
const { data, error } = await client.send({ /* … */});
if (error) { // error.message is the API's message return;}
data.id; // non-null here — TypeScript narrows after the early returnAfter if (error) returns or throws, data is non-null. Don’t add fallbacks for thrown SDK errors — they can’t happen.