Error Handling

Learn how to handle errors and edge cases when using the Finatic SDK.

Understanding how to handle errors is crucial for building robust applications with Finatic. This guide covers error handling patterns, common error types, and best practices.

Note: All Finatic methods return a standard response format. Familiarize yourself with the response structure before diving into error handling.

Error Response Structure

When an error occurs, the response looks like this:

1{ 2 success: null, 3 error: { 4 message: "Error description", 5 code?: "ERROR_CODE", 6 status?: 400, 7 details?: { /* additional error details */ } 8 }, 9 warning: null 10} 11

The error object contains:

  • message: Human-readable error description (always present)
  • code (optional): Machine-readable error code for programmatic handling
  • status (optional): HTTP status code (401, 404, 500, etc.)
  • details (optional): Additional context (validation errors, affected fields, etc.)

Basic Error Handling

Always check for errors before accessing data. Here's an example using getAccounts():

Loading...