Exceptions

Exception hierarchy. All exceptions raised by lptk inherit from LPTKError, allowing a single except clause to catch any package-specific error.

exception lptk.LPTKError

Bases: Exception

Base exception for all lptk errors.

Parameters:
  • message (str) – Human-readable error description.

  • details (dict[str, Any] | None (default: None)) – Optional dictionary with additional context.

__init__(message, details=None)

Store the message and any structured context.

exception lptk.ConfigurationError

Bases: LPTKError

Raised when configuration is invalid or missing.

Examples

  • Missing API token file

  • Invalid environment variable values

  • Missing required settings

exception lptk.APIError

Bases: LPTKError

Base exception for API-related errors.

Parameters:
  • message (str) – Human-readable error description.

  • status_code (int | None (default: None)) – HTTP status code if applicable.

  • details (dict[str, Any] | None (default: None)) – Optional dictionary with additional context.

__init__(message, status_code=None, details=None)

Store the HTTP status code alongside the base error fields.

exception lptk.StartGGAPIError

Bases: APIError

Raised when start.gg API requests fail.

Examples

  • HTTP errors from the GraphQL endpoint

  • GraphQL query errors

  • Rate limiting responses

exception lptk.WikitextParseError

Bases: LPTKError

Raised when wikitext parsing fails.

Examples

  • Malformed template syntax

  • Unexpected wikitext structure

  • Missing required template parameters