Covert an exception list into a :class:`.RedditErrorItem` list.
(
exceptions: list[RedditErrorItem | list[str]],
)
| 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. |
no test coverage detected