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/main/prawcore/exceptions.py
praw.exceptions¶
PRAW exception classes.
Includes two main exceptions: RedditAPIException 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.
All other exceptions are subclassed from ClientException.
- exception praw.exceptions.ClientException¶
Indicate exceptions that don’t involve interaction with Reddit’s API.
- __init__(*args, **kwargs)¶
- add_note(object, /)¶
Exception.add_note(note) – add a note to the exception
- with_traceback(object, /)¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception praw.exceptions.DuplicateReplaceException¶
Indicate exceptions that involve the replacement of
MoreComments.- Return type:
None
- __init__()¶
Initialize a
DuplicateReplaceExceptioninstance.- Return type:
None
- add_note(object, /)¶
Exception.add_note(note) – add a note to the exception
- with_traceback(object, /)¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception praw.exceptions.InvalidFlairTemplateID(template_id)¶
Indicate exceptions where an invalid flair template ID is given.
- Parameters:
template_id (str)
- Return type:
None
- __init__(template_id)¶
Initialize an
InvalidFlairTemplateIDinstance.- Parameters:
template_id (str)
- Return type:
None
- add_note(object, /)¶
Exception.add_note(note) – add a note to the exception
- with_traceback(object, /)¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception praw.exceptions.InvalidImplicitAuth¶
Indicate exceptions where an implicit auth type is used incorrectly.
- Return type:
None
- __init__()¶
Initialize an
InvalidImplicitAuthinstance.- Return type:
None
- add_note(object, /)¶
Exception.add_note(note) – add a note to the exception
- with_traceback(object, /)¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception praw.exceptions.InvalidURL(url, *, message='Invalid URL: {}')¶
Indicate exceptions where an invalid URL is entered.
- __init__(url, *, message='Invalid URL: {}')¶
Initialize an
InvalidURLinstance.
- add_note(object, /)¶
Exception.add_note(note) – add a note to the exception
- with_traceback(object, /)¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception praw.exceptions.MediaPostFailed¶
Indicate exceptions where media uploads failed..
- Return type:
None
- __init__()¶
Initialize a
MediaPostFailedinstance.- Return type:
None
- add_note(object, /)¶
Exception.add_note(note) – add a note to the exception
- with_traceback(object, /)¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception praw.exceptions.MissingRequiredAttributeException¶
Indicate exceptions caused by not including a required attribute.
- __init__(*args, **kwargs)¶
- add_note(object, /)¶
Exception.add_note(note) – add a note to the exception
- with_traceback(object, /)¶
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__(*args, **kwargs)¶
- add_note(object, /)¶
Exception.add_note(note) – add a note to the exception
- with_traceback(object, /)¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception praw.exceptions.ReadOnlyException¶
Raised when a method call requires
read_onlymode to be disabled.- __init__(*args, **kwargs)¶
- add_note(object, /)¶
Exception.add_note(note) – add a note to the exception
- with_traceback(object, /)¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception praw.exceptions.RedditAPIException(items)¶
Container for error messages from Reddit’s API.
- Parameters:
items (list[RedditErrorItem | list[str] | str])
- Return type:
None
- __init__(items)¶
Initialize a
RedditAPIExceptioninstance.- Parameters:
items (
list[RedditErrorItem|list[str] |str]) – Either a list of instances ofRedditErrorItemor a list containing lists of unformed errors.- Return type:
None
- add_note(object, /)¶
Exception.add_note(note) – add a note to the exception
- static parse_exception_list(exceptions)¶
Covert an exception list into a
RedditErrorItemlist.- Return type:
- Parameters:
exceptions (list[RedditErrorItem | list[str]])
- with_traceback(object, /)¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- class praw.exceptions.RedditErrorItem(error_type, *, field=None, message=None)¶
Represents a single error returned from Reddit’s API.
- __init__(error_type, *, field=None, message=None)¶
Initialize a
RedditErrorIteminstance.
- exception praw.exceptions.TooLargeMediaException(*, actual, maximum_size)¶
Indicate exceptions from uploading media that’s too large.
- __init__(*, actual, maximum_size)¶
Initialize a
TooLargeMediaExceptioninstance.
- add_note(object, /)¶
Exception.add_note(note) – add a note to the exception
- with_traceback(object, /)¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception praw.exceptions.WebSocketException(message)¶
Indicate exceptions caused by use of WebSockets.
- Parameters:
message (str)
- Return type:
None
- __init__(message)¶
Initialize a
WebSocketExceptioninstance.- Parameters:
message (
str) – The exception message.- Return type:
None
- add_note(object, /)¶
Exception.add_note(note) – add a note to the exception
- with_traceback(object, /)¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.