Add a bit more details to some errors.

pull/1741/head
Chaz Larson 1 year ago
parent 19dac0b6b1
commit 9c2f91b8ca

@ -275,7 +275,7 @@ class Library(ABC):
exif_tags = image.getexif()
if 0x04bc in exif_tags and exif_tags[0x04bc] == "overlay":
os.remove(image_path)
raise Failed("Poster already has an Overlay")
raise Failed("This item's poster already has an Overlay. There is no PMM setting to change; manual attention required.")
if remove:
os.remove(image_path)
else:

@ -205,6 +205,6 @@ class Mdblist:
results.append((item["id"], "tmdb" if item["mediatype"] == "movie" else "tmdb_show"))
return results
except JSONDecodeError:
raise Failed(f"Mdblist Error: Invalid Response")
raise Failed(f"Mdblist Error: Invalid JSON Response received")
else:
raise Failed(f"Mdblist Error: Method {method} not supported")

@ -17,7 +17,7 @@ class Notifiarr:
try:
self.request(path="user", params={"fetch": "settings"})
except JSONDecodeError:
raise Failed("Notifiarr Error: Invalid response")
raise Failed("Notifiarr Error: Invalid JSON response received")
def notification(self, json):
return self.request(json=json)

@ -155,8 +155,10 @@ class Overlay:
def get_and_save_image(image_url):
response = self.config.get(image_url)
if response.status_code >= 400:
if response.status_code == 404:
raise Failed(f"Overlay Error: Overlay Image not found at: {image_url}")
if response.status_code >= 400:
raise Failed(f"Overlay Error: Status {response.status_code} when attempting download of: {image_url}")
if "Content-Type" not in response.headers or response.headers["Content-Type"] != "image/png":
raise Failed(f"Overlay Error: Overlay Image not a png: {image_url}")
if not os.path.exists(library.overlay_folder) or not os.path.isdir(library.overlay_folder):

@ -1358,7 +1358,7 @@ class Plex(Library):
else:
starting = item
if not starting.locations:
raise Failed(f"Asset Warning: No video filepath found fo {item.title}")
raise Failed(f"Asset Warning: No video filepath found for {item.title}")
path_test = str(starting.locations[0])
if not os.path.dirname(path_test):
path_test = path_test.replace("\\", "/")

@ -170,8 +170,10 @@ def quote(data):
def download_image(title, image_url, download_directory, filename=None):
response = requests.get(image_url, headers=header())
if response.status_code == 404:
raise Failed(f"Image Error: Not Found on Image URL: {image_url}")
if response.status_code >= 400:
raise Failed(f"Image Error: Failed to download Image URL: {image_url}")
raise Failed(f"Image Error: {response.status_code} on Image URL: {image_url}")
if "Content-Type" not in response.headers or response.headers["Content-Type"] not in image_content_types:
raise Failed("Image Not PNG, JPG, or WEBP")
new_image = os.path.join(download_directory, f"{filename}") if filename else download_directory

Loading…
Cancel
Save