@@ -30,25 +30,6 @@ def lambda_handler(event: Dict[str, Any], context: Any) -> Dict[str, Any]:
3030 # Log incoming request
3131 logger .info (f"Received request: { json .dumps (event )} " )
3232
33- # Safely extract execution ARN
34- if 'arguments' not in event :
35- logger .error ("Missing 'arguments' in event" )
36- return {
37- 'executionArn' : 'Unknown' ,
38- 'status' : 'ERROR' ,
39- 'error' : "Missing arguments in request" ,
40- 'steps' : []
41- }
42-
43- if 'executionArn' not in event ['arguments' ]:
44- logger .error ("Missing 'executionArn' in arguments" )
45- return {
46- 'executionArn' : 'Unknown' ,
47- 'status' : 'ERROR' ,
48- 'error' : "Missing executionArn in arguments" ,
49- 'steps' : []
50- }
51-
5233 execution_arn = event ['arguments' ]['executionArn' ]
5334 logger .info (f"Getting execution details for: { execution_arn } " )
5435
@@ -61,12 +42,7 @@ def lambda_handler(event: Dict[str, Any], context: Any) -> Dict[str, Any]:
6142 except Exception as api_error :
6243 logger .error (f"describe_execution API call failed: { str (api_error )} " )
6344 logger .error (f"Error details: { traceback .format_exc ()} " )
64- return {
65- 'executionArn' : execution_arn ,
66- 'status' : 'ERROR' ,
67- 'error' : f"Failed to describe execution: { str (api_error )} " ,
68- 'steps' : []
69- }
45+ raise api_error
7046
7147 api_duration = (datetime .now () - start_time ).total_seconds ()
7248 logger .info (f"describe_execution API call took { api_duration :.2f} seconds" )
@@ -107,12 +83,7 @@ def lambda_handler(event: Dict[str, Any], context: Any) -> Dict[str, Any]:
10783 except Exception as history_error :
10884 logger .error (f"Failed to fetch execution history page { page_count } : { str (history_error )} " )
10985 logger .error (f"Error details: { traceback .format_exc ()} " )
110- return {
111- 'executionArn' : execution_arn ,
112- 'status' : 'ERROR' ,
113- 'error' : f"Failed to fetch execution history: { str (history_error )} " ,
114- 'steps' : []
115- }
86+ raise history_error
11687
11788 history_duration = (datetime .now () - history_start_time ).total_seconds ()
11889 logger .info (f"Retrieved { len (all_events )} total events in { page_count } pages, took { history_duration :.2f} seconds" )
@@ -188,14 +159,8 @@ def lambda_handler(event: Dict[str, Any], context: Any) -> Dict[str, Any]:
188159 logger .error (f"Error getting Step Functions execution: { str (e )} " )
189160 logger .error (f"Traceback: { traceback .format_exc ()} " )
190161 # Return error in a format that can be displayed in the UI
191- execution_arn = 'Unknown'
192- try :
193- execution_arn = event .get ('arguments' , {}).get ('executionArn' , 'Unknown' )
194- except :
195- pass
196-
197162 return {
198- 'executionArn' : execution_arn ,
163+ 'executionArn' : event [ 'arguments' ]. get ( 'executionArn' , 'Unknown' ) ,
199164 'status' : 'ERROR' ,
200165 'error' : f"Failed to retrieve execution details: { str (e )} " ,
201166 'steps' : []
0 commit comments