Module pyreddit.exceptions

Catched exceptions of the software.

The application follows the try/catch pattern to return errors in the program flow between two functions.

Classes

class RedditError (msg: Any, data: Any = None, capture: bool = False)

Base class for all catched exceptions.

Parameters

msg : str
Exception message to be bubbled up.
data : dict (Default value = None)
Extra data to be sent to Sentry if capture is set to True.
capture : Boolean (Default value = False)
Whether to send the exception to Sentry issue tracking service, if Sentry is configured.

Notes

All children exceptions have the same parameters.

Ancestors

  • builtins.Exception
  • builtins.BaseException

Subclasses

class AuthenticationError (data: Any = None, capture: bool = True)

Raised when a service cannot authenticate to the API provider.

Ancestors

  • RedditError
  • builtins.Exception
  • builtins.BaseException
class SubredditError (msg: Any, data: Any = None, capture: bool = False)

Base class for subreddit related exceptions.

Capture

Unless specified otherwise, these are not a true error of the application and originate from a "correct" subreddit property, such as it being private or not existing, and therfore should not be captured by Sentry.

Ancestors

  • RedditError
  • builtins.Exception
  • builtins.BaseException

Subclasses

class PostError (msg: Any, data: Any = None, capture: bool = True)

Base class for post related exceptions.

Capture

Unless specified otherwise, these are true errors of the application and should be captured by Sentry.

Ancestors

  • RedditError
  • builtins.Exception
  • builtins.BaseException

Subclasses

class MediaError (msg: Any, data: Any = None, capture: bool = True)

Base class for media related exceptions.

Capture

These errors cause the retrieved post not to be sent, or to be sent not as it should be. Therefore they represent a critical part of the application. For this, unless specified otherwise, they should be captured by Sentry.

Ancestors

  • RedditError
  • builtins.Exception
  • builtins.BaseException

Subclasses

class SubredditPrivateError (data: Any = None, capture: bool = False)

Raised when the subreddit is private, and therefore cannot be fetched.

Ancestors

class SubredditDoesntExistError (data: Any = None, capture: bool = False)

Raised when the subreddit does not exist.

Ancestors

class PostRequestError (data: Any = None, capture: bool = True)

Raised when there's an error in the post request.

Note: Not to be confused with PostRetrievalError

Ancestors

class PostRetrievalError (data: Any = None, capture: bool = True)

Raised when there's an error in the post json.

E.g. a mandatory json field is missing or the json is not strucutred as expected.

Ancestors

class MediaRetrievalError (data: Any = None, capture: bool = True)

Raised when there's an error in the media retrieval request.

Ancestors