Exceptions in Async PRAW¶
In addition to exceptions under the asyncpraw.exceptions
namespace shown below,
exceptions might be raised that inherit from
asyncprawcore.AsyncPrawcoreException
. Please see the following resource for
information on those exceptions:
https://github.com/praw-dev/asyncprawcore/blob/master/asyncprawcore/exceptions.py
asyncpraw.exceptions¶
Async 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
AsyncPRAWException
.
All other exceptions are subclassed from ClientException
.
-
exception
asyncpraw.exceptions.
APIException
(items: Union[List[Union[asyncpraw.exceptions.RedditErrorItem, List[str], str]], str], *optional_args: str)¶ Old class preserved for alias purposes.
Deprecated since version 7.0: Class
APIException
has been deprecated in favor ofRedditAPIException
. This class will be removed in Async PRAW 8.0.-
__init__
(items: Union[List[Union[asyncpraw.exceptions.RedditErrorItem, List[str], str]], str], *optional_args: str)¶ Initialize an instance of RedditAPIException.
- Parameters
items – Either a list of instances of
RedditErrorItem
or a list containing lists of unformed errors.optional_args – Takes the second and third arguments that
APIException
used to take.
-
error_type
¶ Get error_type.
Deprecated since version 7.0: Accessing attributes through instances of
RedditAPIException
is deprecated. This behavior will be removed in Async PRAW 8.0. Check out the PRAW 7 Migration tutorial on how to migrate code from this behavior.
-
field
¶ Get field.
Deprecated since version 7.0: Accessing attributes through instances of
RedditAPIException
is deprecated. This behavior will be removed in Async PRAW 8.0. Check out the PRAW 7 Migration tutorial on how to migrate code from this behavior.
-
message
¶ Get message.
Deprecated since version 7.0: Accessing attributes through instances of
RedditAPIException
is deprecated. This behavior will be removed in Async PRAW 8.0. Check out the Async PRAW 7 Migration tutorial on how to migrate code from this behavior.
-
staticmethod
parse_exception_list
(exceptions: List[Union[asyncpraw.exceptions.RedditErrorItem, List[str]]])¶ Covert an exception list into a
RedditErrorItem
list.
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
exception
asyncpraw.exceptions.
AsyncPRAWException
¶ The base Async 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.
-
-
exception
asyncpraw.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
asyncpraw.exceptions.
DuplicateReplaceException
¶ Indicate exceptions that involve the replacement of MoreComments.
-
__init__
()¶ Initialize the class.
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
class
asyncpraw.exceptions.
ExceptionWrapper
(wrapped)¶ Wrapper to facilitate showing depreciation for PRAWException class rename.
-
__init__
(wrapped)¶ Initialize Wrapper instance.
-
-
exception
asyncpraw.exceptions.
InvalidFlairTemplateID
(template_id: str)¶ Indicate exceptions where an invalid flair template id is given.
-
__init__
(template_id: str)¶ Initialize the class.
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
exception
asyncpraw.exceptions.
InvalidImplicitAuth
¶ Indicate exceptions where an implicit auth type is used incorrectly.
-
__init__
()¶ Initialize the class.
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
exception
asyncpraw.exceptions.
InvalidURL
(url: str, message: str = 'Invalid URL: {}')¶ Indicate exceptions where an invalid URL is entered.
-
__init__
(url: str, message: str = 'Invalid URL: {}')¶ Initialize the class.
- Parameters
url – The invalid URL.
message – The message to display. Must contain a format identifier (
{}
or{0}
). (default:"Invalid URL: {}"
)
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
exception
asyncpraw.exceptions.
MediaPostFailed
¶ Indicate exceptions where media uploads failed..
-
__init__
()¶ Initialize MediaPostFailed.
-
original_exception
¶ Access the original_exception attribute (now deprecated).
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
exception
asyncpraw.exceptions.
MissingRequiredAttributeException
¶ Indicate exceptions caused by not including a required attribute.
-
__init__
()¶ Initialize self. See help(type(self)) for accurate signature.
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
asyncpraw.exceptions.
PRAWException
¶
-
exception
asyncpraw.exceptions.
RedditAPIException
(items: Union[List[Union[asyncpraw.exceptions.RedditErrorItem, List[str], str]], str], *optional_args: str)¶ Container for error messages from Reddit’s API.
-
__init__
(items: Union[List[Union[asyncpraw.exceptions.RedditErrorItem, List[str], str]], str], *optional_args: str)¶ Initialize an instance of RedditAPIException.
- Parameters
items – Either a list of instances of
RedditErrorItem
or a list containing lists of unformed errors.optional_args – Takes the second and third arguments that
APIException
used to take.
-
error_type
¶ Get error_type.
Deprecated since version 7.0: Accessing attributes through instances of
RedditAPIException
is deprecated. This behavior will be removed in Async PRAW 8.0. Check out the PRAW 7 Migration tutorial on how to migrate code from this behavior.
-
field
¶ Get field.
Deprecated since version 7.0: Accessing attributes through instances of
RedditAPIException
is deprecated. This behavior will be removed in Async PRAW 8.0. Check out the PRAW 7 Migration tutorial on how to migrate code from this behavior.
-
message
¶ Get message.
Deprecated since version 7.0: Accessing attributes through instances of
RedditAPIException
is deprecated. This behavior will be removed in Async PRAW 8.0. Check out the Async PRAW 7 Migration tutorial on how to migrate code from this behavior.
-
staticmethod
parse_exception_list
(exceptions: List[Union[asyncpraw.exceptions.RedditErrorItem, List[str]]])¶ Covert an exception list into a
RedditErrorItem
list.
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
class
asyncpraw.exceptions.
RedditErrorItem
(error_type: str, message: str, field: Optional[str] = None)¶ Represents a single error returned from Reddit’s API.
-
__init__
(error_type: str, message: str, field: Optional[str] = None)¶ Initialize an error item.
- 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.
-
error_message
¶ Get the completed error message string.
-
-
exception
asyncpraw.exceptions.
TooLargeMediaException
(maximum_size: int, actual: int)¶ Indicate exceptions from uploading media that’s too large.
-
__init__
(maximum_size: int, actual: int)¶ Initialize a TooLargeMediaException.
- Parameters
maximum_size – The maximum_size size of the uploaded media.
actual – The actual size of the uploaded media.
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
exception
asyncpraw.exceptions.
WebSocketException
(message: str, exception: Optional[Exception])¶ Indicate exceptions caused by use of WebSockets.
-
__init__
(message: str, exception: Optional[Exception])¶ Initialize a WebSocketException.
- Parameters
message – The exception message.
exception –
The exception thrown by the websocket library.
Note
This parameter is deprecated. It will be removed in Async PRAW 8.0.
-
original_exception
¶ Access the original_exception attribute (now deprecated).
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-