Exceptions in PRAW

In addition to exceptions under the praw.exceptions namespace shown below, exceptions might be raised that inherit from prawcore.PrawcoreException. Please see the following resource for information on those exceptions: https://github.com/praw-dev/prawcore/blob/master/prawcore/exceptions.py

praw.exceptions

PRAW exception classes.

Includes two main exceptions: APIException for when something goes wrong on the server side, and ClientException when something goes wrong on the client side. Both of these classes extend PRAWException.

exception praw.exceptions.APIException(error_type, message, field)

Indicate exception that involve responses from Reddit’s API.

__init__(error_type, message, field)

Initialize an instance of APIException.

Parameters:
  • error_type – The error type set on Reddit’s end.
  • message – The associated message for the error.
  • field – The input field associated with the error if available.

Note

Calling str() on the instance returns unicode_escape-d ASCII string because the message may be localized and may contain UNICODE characters. If you want a non-escaped message, access the message attribute on the instance.

with_traceback()

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

exception praw.exceptions.ClientException

Indicate exceptions that don’t involve interaction with Reddit’s API.

__init__

Initialize self. See help(type(self)) for accurate signature.

with_traceback()

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

exception praw.exceptions.PRAWException

The base PRAW Exception that all other exception classes extend.

__init__

Initialize self. See help(type(self)) for accurate signature.

with_traceback()

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