Skip to main content

Error Handling

When the server returns an error for a call, Axios rejects the promise with an error containing the HTTP status and data.

Examples of sources:

  • Nest HttpException → code/status and message
  • Network errors → Axios network error

Handle errors per-call:

try {
await rpc.user.queries.getUser({ id: 'missing' });
} catch (e) {
// AxiosError
console.error(e.response?.status, e.response?.data);
}

Further reading: