Skip to content

Commit

Permalink
Update safe.py
Browse files Browse the repository at this point in the history
Return a better exception when adding members to a non-existent safe
  • Loading branch information
safepost authored Mar 29, 2024
1 parent 57a6ace commit 91fe0bc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions aiobastion/safe.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,11 @@ async def list_members(self, safe_name: str, filter_perm=None, details=False, ra

#url = f"WebServices/PIMServices.svc/Safes/{safe_name}/Members"
url = f"api/Safes/{safe_name}/Members"
members = await self.epv.handle_request("get", url, filter_func=lambda x: x["value"])

try:
members = await self.epv.handle_request("get", url, filter_func=lambda x: x["value"])
except CyberarkException as err:
raise CyberarkAPIException(404, "ERR_404", f"Safe {safe_name} doesn't exist")

if raw:
return members

Expand Down

0 comments on commit 91fe0bc

Please sign in to comment.