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/main/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.AsyncPRAWException

The base Async PRAW Exception that all other exception classes extend.

__init__(*args, **kwargs)
add_note(note, /)

Add a note to the 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__(*args, **kwargs)
add_note(note, /)

Add a note to the exception

with_traceback(tb, /)

Set self.__traceback__ to tb and return self.

exception asyncpraw.exceptions.DuplicateReplaceException

Indicate exceptions that involve the replacement of MoreComments.

Return type:

None

__init__()

Initialize a DuplicateReplaceException instance.

Return type:

None

add_note(note, /)

Add a note to the exception

with_traceback(tb, /)

Set self.__traceback__ to tb and return self.

exception asyncpraw.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 InvalidFlairTemplateID instance.

Parameters:

template_id (str)

Return type:

None

add_note(note, /)

Add a note to the 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.

Return type:

None

__init__()

Initialize an InvalidImplicitAuth instance.

Return type:

None

add_note(note, /)

Add a note to the exception

with_traceback(tb, /)

Set self.__traceback__ to tb and return self.

exception asyncpraw.exceptions.InvalidURL(url, *, message='Invalid URL: {}')

Indicate exceptions where an invalid URL is entered.

Parameters:
Return type:

None

__init__(url, *, message='Invalid URL: {}')

Initialize an InvalidURL instance.

Parameters:
  • url (str) – The invalid URL.

  • message (str) – The message to display. Must contain a format identifier ({} or {0}) (default: "Invalid URL: {}").

Return type:

None

add_note(note, /)

Add a note to the exception

with_traceback(tb, /)

Set self.__traceback__ to tb and return self.

exception asyncpraw.exceptions.MediaPostFailed

Indicate exceptions where media uploads failed..

Return type:

None

__init__()

Initialize a MediaPostFailed instance.

Return type:

None

add_note(note, /)

Add a note to the 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__(*args, **kwargs)
add_note(note, /)

Add a note to the exception

with_traceback(tb, /)

Set self.__traceback__ to tb and return self.

exception asyncpraw.exceptions.ReadOnlyException

Raised when a method call requires read_only mode to be disabled.

__init__(*args, **kwargs)
add_note(note, /)

Add a note to the exception

with_traceback(tb, /)

Set self.__traceback__ to tb and return self.

exception asyncpraw.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 RedditAPIException instance.

Parameters:

items (list[RedditErrorItem | list[str] | str]) – Either a list of instances of RedditErrorItem or a list containing lists of unformed errors.

Return type:

None

add_note(note, /)

Add a note to the exception

staticmethod parse_exception_list(exceptions)

Covert an exception list into a RedditErrorItem list.

Return type:

list[RedditErrorItem]

Parameters:

exceptions (list[RedditErrorItem | list[str]])

with_traceback(tb, /)

Set self.__traceback__ to tb and return self.

class asyncpraw.exceptions.RedditErrorItem(error_type, *, field=None, message=None)

Represents a single error returned from Reddit’s API.

Parameters:
  • error_type (str)

  • field (str | None)

  • message (str | None)

__init__(error_type, *, field=None, message=None)

Initialize a RedditErrorItem instance.

Parameters:
  • error_type (str) – The error type set on Reddit’s end.

  • field (str | None) – The input field associated with the error, if available.

  • message (str | None) – The associated message for the error.

Return type:

None

property error_message: str

Get the completed error message string.

exception asyncpraw.exceptions.TooLargeMediaException(*, actual, maximum_size)

Indicate exceptions from uploading media that’s too large.

Parameters:
  • actual (int)

  • maximum_size (int)

Return type:

None

__init__(*, actual, maximum_size)

Initialize a TooLargeMediaException instance.

Parameters:
  • actual (int) – The actual size of the uploaded media.

  • maximum_size (int) – The maximum size of the uploaded media.

Return type:

None

add_note(note, /)

Add a note to the exception

with_traceback(tb, /)

Set self.__traceback__ to tb and return self.

exception asyncpraw.exceptions.WebSocketException(message)

Indicate exceptions caused by use of WebSockets.

Parameters:

message (str)

Return type:

None

__init__(message)

Initialize a WebSocketException instance.

Parameters:

message (str) – The exception message.

Return type:

None

add_note(note, /)

Add a note to the exception

with_traceback(tb, /)

Set self.__traceback__ to tb and return self.