Skip to main content

Documentation Index

Fetch the complete documentation index at: https://developers.fathom.ai/llms.txt

Use this file to discover all available pages before exploring further.

Error Handling

Both TypeScript and Python SDKs provide comprehensive error handling capabilities. The base error class is FathomError for both SDKs.

Basic Error Handling

import { Fathom } from 'fathom-typescript';
import * as errors from 'fathom-typescript/models/errors';

const fathom = new Fathom({
  security: {
    apiKeyAuth: "YOUR_API_KEY"
  }
});

try {
  const result = await fathom.listMeetings({});
  for await (const page of result) {
    console.log(page);
  }
} catch (error) {
  if (error instanceof errors.FathomError) {
    console.log(error.message);
    console.log(error.statusCode);
    console.log(error.body);
    console.log(error.headers);
  }
}

Handle Specific Status Codes

import { Fathom } from 'fathom-typescript';
import * as errors from 'fathom-typescript/models/errors';

async function handleSpecificErrors() {
  const fathom = new Fathom({
    security: {
      apiKeyAuth: "YOUR_API_KEY"
    }
  });

  try {
    const result = await fathom.listMeetings({});
    return result;
  } catch (error) {
    if (error instanceof errors.FathomError) {
      switch (error.statusCode) {
        case 401:
          console.log("Authentication failed. Check your API key.");
          break;
        case 403:
          console.log("Access forbidden. Check your permissions.");
          break;
        case 404:
          console.log("Resource not found.");
          break;
        case 429:
          console.log("Rate limit exceeded. Try again later.");
          break;
        default:
          if (error.statusCode >= 500) {
            console.log("Server error. Try again later.");
          } else {
            console.log(`Unexpected error: ${error.message}`);
          }
      }
    }
    return null;
  }
}

Error Classes

Primary error:
  • FathomError: The base class for HTTP error responses.
Network errors (TypeScript):
  • ConnectionError: HTTP client was unable to make a request to a server.
  • RequestTimeoutError: HTTP request timed out due to an AbortSignal signal.
  • RequestAbortedError: HTTP request was aborted by the client.
  • InvalidRequestError: Any input used to create a request is invalid.
  • UnexpectedClientError: Unrecognised or unexpected error.
Network errors (Python):
  • httpx.RequestError: Base class for request errors.
  • httpx.ConnectError: HTTP client was unable to make a request to a server.
  • httpx.TimeoutException: HTTP request timed out.
Inherit from FathomError:
  • ResponseValidationError: Type mismatch between the response data and the expected model structure.