Skip to content

Exceptions

Exception hierarchy for handling errors.

Base Exceptions

gdpy.exceptions.base.GDError

Bases: Exception

Base exception for all gdpy errors.

All exceptions in gdpy inherit from this class, allowing you to catch any gdpy-related error with a single except clause.

Example
try:
    user = await client.get_user(account_id=999999)
except GDError as e:
    print(f"gdpy error: {e}")

gdpy.exceptions.base.RequestError

Bases: GDError

Base exception for request-related errors.

This is the parent class for errors that occur during API requests, including authentication errors, rate limiting, and not found errors.

Authentication Errors

gdpy.exceptions.auth.AuthError

Bases: RequestError

Base exception for authentication errors.

Raised when authentication-related operations fail.

gdpy.exceptions.auth.InvalidCredentialsError

Bases: AuthError

Raised when login credentials are incorrect.

This exception is raised when attempting to login with an invalid username or password combination.

Attributes:

Name Type Description
error_code

The API error code (-11).

gdpy.exceptions.auth.AccountDisabledError

Bases: AuthError

Raised when the account has been disabled.

This exception is raised when attempting to login to an account that has been banned or disabled by moderators.

Attributes:

Name Type Description
error_code

The API error code (-12).

Request Errors

gdpy.exceptions.invalid_request.InvalidRequestError

Bases: RequestError

gdpy.exceptions.not_found.NotFoundError

Bases: RequestError

Registration Errors

gdpy.exceptions.registration.RegistrationError

Bases: GDError

gdpy.exceptions.registration.UsernameTakenError

gdpy.exceptions.registration.EmailTakenError

gdpy.exceptions.registration.PasswordTooShortError

gdpy.exceptions.registration.UsernameTooShortError

Validation Errors

gdpy.exceptions.validation.ValidationError

Bases: GDError