@@ -244,7 +244,8 @@ def get_user_group(group_id: str):
244244 else :
245245 return Response (response = json .dumps (user_group .to_item ()), status = 200 )
246246 except Exception as e :
247- return Response (response = str (e ), status = 500 )
247+ app .logger .error (f"Error in get_user_group: { e } " )
248+ return Response (response = "An internal error has occurred." , status = 500 )
248249
249250@app .route ('/user-groups/user/<user_id>' , methods = ['GET' ])
250251def get_user_member_groups (user_id : str ):
@@ -255,7 +256,8 @@ def get_user_member_groups(user_id: str):
255256 else :
256257 return Response (response = json .dumps ([user_group .to_item_no_users () for user_group in user_groups ]), status = 200 )
257258 except Exception as e :
258- return Response (response = str (e ), status = 500 )
259+ app .logger .error (f"Error in get_user_member_groups: { e } " )
260+ return Response (response = "An internal error has occurred." , status = 500 )
259261
260262@app .route ('/user-groups/<group_id>' , methods = ['PUT' ])
261263def update_user_group (group_id : str ):
@@ -277,7 +279,8 @@ def update_user_group(group_id: str):
277279 except SessionNotFoundError as e :
278280 return Response (response = str (e ), status = 404 )
279281 except Exception as e :
280- return Response (response = str (e ), status = 500 )
282+ app .logger .error (f"Error in update_user_group: { e } " )
283+ return Response (response = "An internal error has occurred." , status = 500 )
281284
282285@app .route ('/resources/<resource_id>' , methods = ['POST' ])
283286def create_resource (resource_id : str ):
@@ -296,7 +299,8 @@ def create_resource(resource_id: str):
296299 except CosmosConflictError as e :
297300 return Response (response = str (e ), status = 409 )
298301 except Exception as e :
299- return Response (response = str (e ), status = 500 )
302+ app .logger .error (f"Error in create_resource: { e } " )
303+ return Response (response = "An internal error has occurred." , status = 500 )
300304
301305@app .route ('/resources/<resource_id>' , methods = ['GET' ])
302306def get_resource (resource_id : str ):
0 commit comments