{ data, error } tuple, @pulsebyshiga/node returns
the value directly and throws. Catch these:
All extend
PulseError, so catch (e) { if (e instanceof PulseError) … }
catches everything from the SDK:
Optional: map into your app’s error layer
If your backend centralizes errors (e.g. behind your ownErrorFactory), map
the SDK’s typed errors the same way you wrap any vendor — keeping the raw
vendor detail in metadata and logs, never in the customer-facing message.
ErrorFactory and logger below are your own utilities, not part of the
SDK — the SDK’s only contract is the four typed errors above.
Error codes
PulseApiError.code is a string set by the API — it isn’t a frozen enum yet. The values
below are the ones you’ll encounter in today’s sandbox; branch on the codes you handle
and treat any unrecognised code defensively (fall back on error.status and
error.message).