Skip to content

Commit c64cf5b

Browse files
committed
add extended error handling to get_item_thumbnail function
1 parent c432975 commit c64cf5b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

dspace_rest_client/client.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1470,8 +1470,15 @@ def get_item_thumbnail(self, item):
14701470
return response
14711471
elif response.status_code == 204:
14721472
return "No thumbnail available for this item"
1473+
elif response.status_code == 401:
1474+
logging.error(f"Unauthorized access for item {item.uuid}")
1475+
elif response.status_code == 403:
1476+
logging.error(f"Forbidden access for item {item.uuid}")
1477+
elif response.status_code == 404:
1478+
logging.error(f"Item or thumbnail not found for item {item.uuid}")
14731479
else:
1474-
return None
1480+
logging.error(f"Unexpected response for item {item.uuid}: {response.status_code}")
1481+
return None
14751482
except Exception as e:
14761483
logging.error(f"Error retrieving thumbnail for item {item.uuid}: {e}")
14771484
return None

0 commit comments

Comments
 (0)