summaryrefslogtreecommitdiffstats
path: root/gallery_dl/exception.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2025-09-16 02:12:49 -0400
committerLibravatarUnit 193 <unit193@unit193.net>2025-09-16 02:12:49 -0400
commit3b7f8716690b7aa1994a9cb387bbc7215e01a4ed (patch)
tree1009e66478f4f0a64324acd92e0cc8709eb5f90f /gallery_dl/exception.py
parent243b2597edb922fe7e0b0d887e80bb7ebbe72ab7 (diff)
New upstream version 1.30.7.upstream/1.30.7
Diffstat (limited to 'gallery_dl/exception.py')
-rw-r--r--gallery_dl/exception.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/gallery_dl/exception.py b/gallery_dl/exception.py
index 6adda0d..559fdd1 100644
--- a/gallery_dl/exception.py
+++ b/gallery_dl/exception.py
@@ -104,13 +104,16 @@ class AuthRequired(AuthorizationError):
if auth:
if not isinstance(auth, str):
auth = " or ".join(auth)
- if " " not in resource:
- resource = "this " + resource
- if message is None:
- message = (f"{auth} needed to access {resource}")
+
+ if resource:
+ if " " not in resource:
+ resource = f"this {resource}"
+ resource = f" to access {resource}"
else:
- message = (f"{auth} needed to access {resource} "
- f"('{message}')")
+ resource = ""
+
+ message = f" ('{message}')" if message else ""
+ message = f"{auth} needed{resource}{message}"
AuthorizationError.__init__(self, message)