Skip to content

Exceptions

All SDK exceptions inherit from ChatwootError. The exception hierarchy maps directly to HTTP status codes so you can catch as broadly or narrowly as needed.

ChatwootError
└── ChatwootAPIError
    ├── ChatwootAuthError        (401)
    ├── ChatwootPermissionError  (403)
    ├── ChatwootNotFoundError    (404)
    └── ChatwootValidationError  (400/422)

exceptions

Custom exceptions for the Chatwoot SDK.

ChatwootError

Bases: Exception

Base exception for all Chatwoot SDK errors.

ChatwootAPIError

ChatwootAPIError(
    status_code: int,
    description: str,
    errors: list[dict] | None = None,
)

Bases: ChatwootError

API returned an error response.

Initialize API error.

Parameters:

Name Type Description Default
status_code int

HTTP status code

required
description str

Error description from API

required
errors list[dict] | None

List of detailed error objects with field, message, code

None

ChatwootAuthError

ChatwootAuthError(
    description: str = "Authentication failed",
    errors: list[dict] | None = None,
)

Bases: ChatwootAPIError

Authentication failed (401).

ChatwootPermissionError

ChatwootPermissionError(
    description: str = "Permission denied",
    errors: list[dict] | None = None,
)

Bases: ChatwootAPIError

Permission denied (403).

ChatwootNotFoundError

ChatwootNotFoundError(
    description: str = "Resource not found",
    errors: list[dict] | None = None,
)

Bases: ChatwootAPIError

Resource not found (404).

ChatwootValidationError

ChatwootValidationError(
    description: str = "Validation failed",
    errors: list[dict] | None = None,
)

Bases: ChatwootAPIError

Request validation failed (400).