MCPcopy Index your code
hub / github.com/praw-dev/praw / parse_exception_list

Method parse_exception_list

praw/exceptions.py:79–94  ·  view source on GitHub ↗

Covert an exception list into a :class:`.RedditErrorItem` list.

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

Source from the content-addressed store, hash-verified

77
78 @staticmethod
79 def parse_exception_list(
80 exceptions: list[RedditErrorItem | list[str]],
81 ) -> list[RedditErrorItem]:
82 """Covert an exception list into a :class:`.RedditErrorItem` list."""
83 return [
84 (
85 exception
86 if isinstance(exception, RedditErrorItem)
87 else RedditErrorItem(
88 error_type=exception[0],
89 field=exception[2] if bool(exception[2]) else "",
90 message=exception[1] if bool(exception[1]) else "",
91 )
92 )
93 for exception in exceptions
94 ]
95
96 def __init__(self, items: list[RedditErrorItem | list[str] | str]) -> None:
97 """Initialize a :class:`.RedditAPIException` instance.

Callers 1

__init__Method · 0.95

Calls 1

RedditErrorItemClass · 0.85

Tested by

no test coverage detected