Skip to content
This repository was archived by the owner on Oct 26, 2025. It is now read-only.

Commit f0b5aa5

Browse files
committed
Better exception handling
1 parent 270e6de commit f0b5aa5

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

plexdl/cli.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414

1515
from plexdl.plexdl import Client
1616

17-
app = typer.Typer(help=__doc__, context_settings={"max_content_width": 9999})
17+
app = typer.Typer(
18+
context_settings={"max_content_width": 9999},
19+
help=__doc__,
20+
pretty_exceptions_enable=False,
21+
)
1822

1923

2024
@app.command()

plexdl/plexdl.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import humanfriendly
88
import requests
9+
from plexapi.exceptions import Unauthorized
910
from plexapi.myplex import MyPlexAccount
1011
from plexapi.server import PlexServer
1112

@@ -121,7 +122,7 @@ def main(self):
121122
for item in this_server_connection.search(self.title):
122123
self.print_all_items_for_server(self, item, this_server.accessToken)
123124

124-
except (requests.exceptions.ConnectionError, requests.exceptions.ReadTimeout) as e:
125+
except (requests.exceptions.ConnectionError, requests.exceptions.ReadTimeout, Unauthorized) as e:
125126
print(f'ERROR: connection to "{this_server.name} {connection.address}" failed.')
126127
log.debug(e)
127128
continue

0 commit comments

Comments
 (0)