Skip to main content
Every SDK method throws a TaxMaxiError when a request fails — whether because of a network problem, an invalid input, an expired session, or a server error. TaxMaxiError extends the built-in Error class with extra fields that let you branch on the failure type without parsing raw error messages.

The TaxMaxiError class

Status codes

Basic try/catch pattern

Wrap any SDK call in a try/catch block and narrow to TaxMaxiError to access the structured fields:

Checking the error code

Use error.code to branch on specific error types without relying on status codes alone:

Extracting field errors

On 400 responses caused by invalid input, the fieldErrors array contains one entry per failing field. Each entry has an optional field name and a human-readable message:

Handling network errors

A status of 0 means the request never reached the server. This can happen when the device is offline, a DNS lookup fails, or a firewall blocks the connection. Retry these errors with back-off rather than surfacing them immediately:
Always log error.requestId when reporting issues to TaxMaxi support. It lets the team trace the exact request in the server logs.