Skip to content

Commit 2f4e1ae

Browse files
committed
adding context to exceptions
1 parent d2c2db4 commit 2f4e1ae

File tree

1 file changed

+21
-3
lines changed
  • services/web/server/src/simcore_service_webserver/wallets

1 file changed

+21
-3
lines changed

services/web/server/src/simcore_service_webserver/wallets/_groups_api.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@ async def create_wallet_group(
4141
)
4242
if wallet.write is False:
4343
raise WalletAccessForbiddenError(
44-
reason=f"User does not have write access to wallet {wallet_id}"
44+
reason=f"User does not have write access to wallet {wallet_id}",
45+
user_id=user_id,
46+
wallet_id=wallet_id,
47+
product_name=product_name,
48+
user_acces_rights_on_wallet=wallet.dict(
49+
include={"read", "write", "delete"}
50+
),
4551
)
4652

4753
wallet_group_db: WalletGroupGetDB = await wallets_groups_db.create_wallet_group(
@@ -69,7 +75,13 @@ async def list_wallet_groups_by_user_and_wallet(
6975
)
7076
if wallet.read is False:
7177
raise WalletAccessForbiddenError(
72-
reason=f"User does not have read access to wallet {wallet_id}"
78+
reason=f"User does not have read access to wallet {wallet_id}",
79+
user_id=user_id,
80+
wallet_id=wallet_id,
81+
product_name=product_name,
82+
user_acces_rights_on_wallet=wallet.dict(
83+
include={"read", "write", "delete"}
84+
),
7385
)
7486

7587
wallet_groups_db: list[
@@ -124,7 +136,13 @@ async def update_wallet_group(
124136
if user["primary_gid"] != wallet.owner:
125137
# Only the owner of the wallet can modify the owner group
126138
raise WalletAccessForbiddenError(
127-
reason=f"User does not have access to modify owner wallet group in wallet {wallet_id}"
139+
reason=f"User does not have access to modify owner wallet group in wallet {wallet_id}",
140+
user_id=user_id,
141+
wallet_id=wallet_id,
142+
product_name=product_name,
143+
user_acces_rights_on_wallet=wallet.dict(
144+
include={"read", "write", "delete"}
145+
),
128146
)
129147

130148
wallet_group_db: WalletGroupGetDB = await wallets_groups_db.update_wallet_group(

0 commit comments

Comments
 (0)