SuitePortal
DevelopersGuides

Error Handling

Learn how to handle errors in the SuitePortal API

Error Handling

Understanding how to handle errors is crucial for building robust integrations.

Error Response Format

{
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable error message"
  }
}

HTTP Status Codes

  • 400 - Bad Request
  • 401 - Unauthorized
  • 403 - Forbidden
  • 404 - Not Found
  • 429 - Too Many Requests
  • 500 - Internal Server Error

Example Error Handling

try {
  const customer = await client.customers.get('customer_123');
} catch (error) {
  if (error.status === 404) {
    console.log('Customer not found');
  }
}