55
66import re
77import time
8+ import traceback
89import boto3
910from slack_sdk import WebClient
1011from app .core .config import (
@@ -86,8 +87,8 @@ def process_async_slack_event(slack_event_data):
8687 )
8788 client .chat_postMessage (channel = channel , text = response_text , thread_ts = thread_ts )
8889
89- except Exception as err :
90- logger .error ("Error processing message" , extra = {"event_id" : event_id , "error" : str ( err )})
90+ except Exception :
91+ logger .error ("Error processing message" , extra = {"event_id" : event_id , "error" : traceback . format_exc ( )})
9192
9293 # incase Slack API call fails, we still want to log the error
9394 try :
@@ -96,8 +97,8 @@ def process_async_slack_event(slack_event_data):
9697 text = BOT_MESSAGES ["error_response" ],
9798 thread_ts = thread_ts ,
9899 )
99- except Exception as post_err :
100- logger .error ("Failed to post error message" , extra = {"error" : str ( post_err )})
100+ except Exception :
101+ logger .error ("Failed to post error message" , extra = {"error" : traceback . format_exc ( )})
101102
102103
103104def get_conversation_session (conversation_key ):
@@ -110,8 +111,8 @@ def get_conversation_session(conversation_key):
110111 logger .info ("Found existing session" , extra = {"conversation_key" : conversation_key })
111112 return response ["Item" ]["session_id" ]
112113 return None
113- except Exception as e :
114- logger .error ("Error getting session" , extra = {"error" : str ( e )})
114+ except Exception :
115+ logger .error ("Error getting session" , extra = {"error" : traceback . format_exc ( )})
115116 return None
116117
117118
@@ -134,8 +135,8 @@ def store_conversation_session(conversation_key, session_id, user_id, channel_id
134135 }
135136 )
136137 logger .info ("Stored session" , extra = {"session_id" : session_id , "conversation_key" : conversation_key })
137- except Exception as e :
138- logger .error ("Error storing session" , extra = {"error" : str ( e )})
138+ except Exception :
139+ logger .error ("Error storing session" , extra = {"error" : traceback . format_exc ( )})
139140
140141
141142def query_bedrock (user_query , session_id = None ):
0 commit comments