Skip to content

Error Handling

Design integrations to handle validation errors, authentication failures, permission failures, rate limits, conflicts, and server errors.

Example

curl -i "$SPENDWARE_BASE_URL/api/v1/projects/" \
  -H "Authorization: Bearer $SPENDWARE_API_KEY"
from spendware_provider_sdk.management import SpendwareManagementClient
from spendware_provider_sdk.management.errors import SpendwareManagementError

try:
    client = SpendwareManagementClient(base_url="SPENDWARE_BASE_URL", api_key="SPENDWARE_API_KEY")
    client.projects.list()
except SpendwareManagementError as exc:
    print(exc.status_code, exc.code, exc.detail)
import { SpendwareManagementClient, SpendwareManagementError } from "@spendware/provider-adapters-sdk/management";

try {
  const client = new SpendwareManagementClient({ baseUrl: "SPENDWARE_BASE_URL", apiKey: "SPENDWARE_API_KEY" });
  await client.projects.list();
} catch (error) {
  if (error instanceof SpendwareManagementError) {
    console.log(error.statusCode, error.code, error.detail);
  }
}

Response Classes

  • 400 or 422: invalid request body, query string, or domain validation.
  • 401: missing or invalid credential.
  • 403: scope or RBAC denial.
  • 404: resource does not exist or is not visible to the caller.
  • 409: conflict, often duplicate or idempotency mismatch.
  • 429: rate limit.
  • 5xx: server-side failure.