@@ -114,32 +114,31 @@ def start_record_or_playback(test_id: str) -> "Tuple[str, Dict[str, str]]":
114114
115115
116116def stop_record_or_playback (test_id : str , recording_id : str , test_variables : "Dict[str, str]" ) -> None :
117- try :
118- http_client = get_http_client ()
119- if is_live ():
120- http_client .request (
121- method = "POST" ,
122- url = RECORDING_STOP_URL ,
123- headers = {
124- "x-recording-file" : test_id ,
125- "x-recording-id" : recording_id ,
126- "x-recording-save" : "true" ,
127- "Content-Type" : "application/json" ,
128- },
129- # tests don't record successfully unless test_variables is a dictionary
130- body = json .dumps (test_variables ).encode ("utf-8" ) if test_variables else "{}" ,
131- )
132- else :
133- http_client .request (
134- method = "POST" ,
135- url = PLAYBACK_STOP_URL ,
136- headers = {"x-recording-id" : recording_id },
137- )
138- except HTTPError as e :
117+ http_client = get_http_client ()
118+ if is_live ():
119+ response = http_client .request (
120+ method = "POST" ,
121+ url = RECORDING_STOP_URL ,
122+ headers = {
123+ "x-recording-file" : test_id ,
124+ "x-recording-id" : recording_id ,
125+ "x-recording-save" : "true" ,
126+ "Content-Type" : "application/json" ,
127+ },
128+ # tests don't record successfully unless test_variables is a dictionary
129+ body = json .dumps (test_variables or {}).encode ("utf-8" ),
130+ )
131+ else :
132+ response = http_client .request (
133+ method = "POST" ,
134+ url = PLAYBACK_STOP_URL ,
135+ headers = {"x-recording-id" : recording_id },
136+ )
137+ if response .status >= 400 :
139138 raise HttpResponseError (
140139 "The test proxy ran into an error while ending the session. Make sure any test variables you record have "
141- "string values."
142- ) from e
140+ f "string values. Full error details: { response . data } "
141+ )
143142
144143
145144def get_proxy_netloc () -> "Dict[str, str]" :
0 commit comments