Error Handling

Error Codes

Complete reference of Synoveo API error codes

All API errors include a structured response with a code, message, and optional details.

Error Response Format

{
  "status": "error",
  "error": {
    "code": "ERROR_CODE",
    "message": "Human-readable description",
    "details": { /* additional context */ }
  }
}

Authentication Errors (401, 403)

CodeHTTPDescriptionRetryable
AUTH_ERROR401Generic authentication failureNo
AUTH_INVALID_TOKEN401Token is invalid or malformedNo
AUTH_TOKEN_EXPIRED401Token has expiredYes (refresh)
AUTH_MISSING_TOKEN401No Authorization headerNo
AUTH_INSUFFICIENT_PERMISSIONS403Token lacks required permissionsNo

Validation Errors (400)

CodeHTTPDescriptionRetryable
VALIDATION_ERROR400Generic validation failureNo
VALIDATION_MISSING_FIELD400Required field not providedNo
VALIDATION_INVALID_FORMAT400Field format is invalidNo
VALIDATION_OUT_OF_RANGE400Value outside acceptable rangeNo

Resource Errors (404, 409)

CodeHTTPDescriptionRetryable
NOT_FOUND404Resource not foundNo
RESOURCE_NOT_FOUND404Specific resource does not existNo
CONFLICT409Resource state conflictNo
DUPLICATE_RESOURCE409Resource already existsNo

Quota & Rate Limiting (429)

CodeHTTPDescriptionRetryable
QUOTA_EXCEEDED429Monthly quota limit reachedYes (after reset)
RATE_LIMIT_EXCEEDED429Too many requests per minuteYes (after delay)

Quota headers included in response:

  • X-Quota-Used: Current usage
  • X-Quota-Limit: Maximum allowed
  • X-Quota-Reset: Reset timestamp
  • Retry-After: Seconds to wait (rate limit)

Plan & Feature Errors (403)

CodeHTTPDescriptionRetryable
PLAN_RESTRICTION403Feature requires higher planNo (upgrade)
FEATURE_NOT_AVAILABLE403Feature not in current planNo (upgrade)
UPGRADE_REQUIRED403Must upgrade to accessNo (upgrade)

Google API Errors (502, 503)

CodeHTTPDescriptionRetryable
GOOGLE_API_ERROR502Google API returned an errorYes
GOOGLE_AUTH_ERROR502Google authentication failedYes (reconnect)
GOOGLE_QUOTA_EXCEEDED503Google's rate limit hitYes (with delay)

Business Logic Errors (422)

CodeHTTPDescriptionRetryable
SYNC_ERROR422Synchronization failedYes
BUSINESS_RULE_VIOLATION422Business rule prevented actionNo
INVALID_STATE422Operation not valid in current stateNo

Server Errors (500)

CodeHTTPDescriptionRetryable
INTERNAL_ERROR500Unexpected server errorYes
DATABASE_ERROR500Database operation failedYes
CONFIGURATION_ERROR500Server misconfigurationNo

SDK Error Handling

import { SynoveoClient, SynoveoError, ErrorCodes } from '@synoveo/sdk'

try {
  await client.posts.create(locationId, post)
} catch (error) {
  if (error instanceof SynoveoError) {
    switch (error.code) {
      case ErrorCodes.QUOTA_EXCEEDED:
        const resetAt = error.details?.resetAt
        console.log(`Quota resets at: ${resetAt}`)
        break

      case ErrorCodes.RATE_LIMIT_EXCEEDED:
        const retryAfter = error.details?.retryAfter
        await sleep(retryAfter * 1000)
        // Retry request
        break

      case ErrorCodes.PLAN_RESTRICTION:
        console.log(`Upgrade to ${error.details?.requiredPlan}`)
        break

      case ErrorCodes.GOOGLE_API_ERROR:
        console.log(`Google error: ${error.message}`)
        break
    }
  }
}

On this page