Error Reference

This page will describe top.py’s errors, and when they’re raised.

class toppy.errors.ToppyError

The base exception for all top.py errors. This exception is inherited from Exception. You could use this as a catchall error for all errors from the module. For example

try:
    await toppy.broken_function()
except toppy.ToppyError:
    print("Error")
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class toppy.errors.Forbidden

Raised whenever a request was rejected due to a lack of correct authentication. Authentication can occur if:

  • You provided an old, expired API Token

  • You have been banned from the top.gg API

class toppy.errors.Ratelimited(retry_after: float = 0.0, *, internal: bool = False)

Raised whenever the client is ratelimited for a long time and refused to handle it.

internal: bool - Boolean indicating if the ratelimit was raised by the precautionary internal ratelimit handler retry_after: float - How long, in seconds, until the ratelimit is lifted. __str__: str - A nicely formatted message describing this error

class toppy.errors.NotFound

Raised when a requested resource is not found.

class toppy.errors.TopGGServerError

Raised whenever the client encounters a 5xx status