Skip to content

Commit 85d7da7

Browse files
committed
fix: enhance error logging in change email process and correct variable assignment in API base URL
1 parent fe4fc57 commit 85d7da7

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

services/web/server/src/simcore_service_webserver/login/_controller/rest/change.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
from ...._meta import API_VTAG
1111
from ....db.plugin import get_asyncpg_engine
12+
from ....exception_handling import create_error_context_from_request
1213
from ....products import products_web
1314
from ....products.models import Product
1415
from ....users import users_service
@@ -258,7 +259,19 @@ async def initiate_change_email(request: web.Request):
258259
},
259260
)
260261
except Exception as err: # pylint: disable=broad-except
261-
_logger.exception("Can not send change_email_email")
262+
_logger.exception(
263+
**create_troubleshooting_log_kwargs(
264+
"Can not send change_email_email",
265+
error=err,
266+
error_context={
267+
"user_id": user["id"],
268+
"user_email": user["email"],
269+
"new_email": request_body.email,
270+
"product_name": product.name,
271+
**create_error_context_from_request(request),
272+
},
273+
)
274+
)
262275
await confirmation_service.delete_confirmation(confirmation)
263276
raise web.HTTPServiceUnavailable(text=MSG_CANT_SEND_MAIL) from err
264277

services/web/server/src/simcore_service_webserver/utils_aiohttp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,5 +171,5 @@ def iter_origins(request: web.Request) -> Iterator[tuple[str, str]]:
171171

172172
def get_api_base_url(request: web.Request) -> str:
173173
scheme, host = next(iter_origins(request))
174-
api_host = api_host = host if is_ip_address(host) else f"api.{host}"
174+
api_host = host if is_ip_address(host) else f"api.{host}"
175175
return f"{scheme}://{api_host}"

0 commit comments

Comments
 (0)