@@ -228,7 +228,6 @@ def main(): # noqa: C901
228228
229229 setup_logging (args , event_bus , args .log_to_file , args .log_file_name , args .filename , run_state .render_id )
230230
231- render_crashed = False
232231 exc_info = None
233232 try :
234233 # Validate API key is present
@@ -240,80 +239,65 @@ def main(): # noqa: C901
240239 console .debug (f"Render ID: { run_state .render_id } " ) # Ensure render ID is logged to the console
241240 render (args , run_state , codeplain_api , event_bus )
242241 except InvalidFridArgument as e :
243- render_crashed = True
244242 exc_info = sys .exc_info ()
245243 console .error (f"Invalid FRID argument: { str (e )} .\n " )
246244 # No need to print render ID since this error is going to be thrown at the very start so user will be able to
247245 # see the render ID that's printed at the very start of the rendering process.
248246 except FileNotFoundError as e :
249- render_crashed = True
250247 exc_info = sys .exc_info ()
251248 console .error (f"File not found: { str (e )} \n " )
252249 console .debug (f"Render ID: { run_state .render_id } " )
253250 except TemplateNotFoundError as e :
254- render_crashed = True
255251 exc_info = sys .exc_info ()
256252 console .error (f"Template not found: { str (e )} \n " )
257253 console .error (system_config .get_error_message ("template_not_found" ))
258254 except PlainSyntaxError as e :
259- render_crashed = True
260255 exc_info = sys .exc_info ()
261256 console .error (f"Plain syntax error: { str (e )} \n " )
262257 except KeyboardInterrupt :
263- render_crashed = True
264258 exc_info = sys .exc_info ()
265259 console .error ("Keyboard interrupt" )
266260 console .debug (f"Render ID: { run_state .render_id } " )
267261 except RequestException as e :
268- render_crashed = True
269262 exc_info = sys .exc_info ()
270263 console .error (f"Error rendering plain code: { str (e )} \n " )
271264 console .debug (f"Render ID: { run_state .render_id } " )
272265 except MissingPreviousFunctionalitiesError as e :
273- render_crashed = True
274266 exc_info = sys .exc_info ()
275267 console .error (f"Error rendering plain code: { str (e )} \n " )
276268 console .debug (f"Render ID: { run_state .render_id } " )
277269 except MissingAPIKey as e :
278270 console .error (f"Missing API key: { str (e )} \n " )
279271 except (InternalServerError , UnexpectedState ) as e :
280- render_crashed = True
281272 exc_info = sys .exc_info ()
282273 console .error (
283274 f"Internal server error: { str (e )} .\n \n Please report the error to support@codeplain.ai with the attached { args .log_file_name } file."
284275 )
285276 console .debug (f"Render ID: { run_state .render_id } " )
286277 except ConflictingRequirements as e :
287- render_crashed = True
288278 exc_info = sys .exc_info ()
289279 console .error (f"Conflicting requirements: { str (e )} \n " )
290280 console .debug (f"Render ID: { run_state .render_id } " )
291281 except CreditBalanceTooLow as e :
292- render_crashed = True
293282 exc_info = sys .exc_info ()
294283 console .error (f"Credit balance too low: { str (e )} \n " )
295284 console .debug (f"Render ID: { run_state .render_id } " )
296285 except LLMInternalError as e :
297- render_crashed = True
298286 exc_info = sys .exc_info ()
299287 console .error (f"LLM internal error: { str (e )} \n " )
300288 console .debug (f"Render ID: { run_state .render_id } " )
301289 except MissingResource as e :
302- render_crashed = True
303290 exc_info = sys .exc_info ()
304291 console .error (f"Missing resource: { str (e )} \n " )
305292 console .debug (f"Render ID: { run_state .render_id } " )
306293 except Exception as e :
307- render_crashed = True
308294 exc_info = sys .exc_info ()
309295 console .error (f"Error rendering plain code: { str (e )} \n " )
310296 console .debug (f"Render ID: { run_state .render_id } " )
311297 finally :
312- if render_crashed :
313- # Log traceback using the logging system if we have exception info
314- if exc_info :
315- logging .error ("Render crashed with exception:" , exc_info = exc_info )
316-
298+ if exc_info :
299+ # Log traceback using the logging system
300+ logging .error ("Render crashed with exception:" , exc_info = exc_info )
317301 dump_crash_logs (args )
318302
319303
0 commit comments