2020 CannotCancelWhileWaitingForManualInterventionError ,
2121 InitialOperationContextKeyNotAllowedError ,
2222 KeyNotFoundInHashError ,
23+ StepNameNotInCurrentGroupError ,
24+ StepNotInErrorStateError ,
25+ StepNotWaitingForManualInterventionError ,
2326 UnexpectedStepHandlingError ,
2427)
2528from ._models import (
@@ -348,8 +351,11 @@ async def restart_operation_step_in_error(
348351 if step_name not in {
349352 step .get_step_name () for step in step_group .get_step_subgroup_to_run ()
350353 }:
351- msg = f"step_name='{ step_name } ' not in current step_group_name='{ step_group_name } ' of operation_name='{ operation_name } '"
352- raise ValueError (msg )
354+ raise StepNameNotInCurrentGroupError (
355+ step_name = step_name ,
356+ step_group_name = step_group_name ,
357+ operation_name = operation_name ,
358+ )
353359
354360 step_proxy = StepStoreProxy (
355361 store = self ._store ,
@@ -363,8 +369,7 @@ async def restart_operation_step_in_error(
363369 try :
364370 await step_proxy .get ("error_traceback" )
365371 except KeyNotFoundInHashError as exc :
366- msg = f"Step '{ step_name } ' is not in error state and cannot be restarted"
367- raise ValueError (msg ) from exc
372+ raise StepNotInErrorStateError (step_name = step_name ) from exc
368373
369374 if in_manual_intervention :
370375 requires_manual_intervention : bool = False
@@ -374,8 +379,7 @@ async def restart_operation_step_in_error(
374379 )
375380
376381 if requires_manual_intervention is False :
377- msg = f"Step '{ step_name } ' is not waiting for manual intervention"
378- raise ValueError (msg )
382+ raise StepNotWaitingForManualInterventionError (step_name = step_name )
379383
380384 await step_proxy .delete ("error_traceback" , "requires_manual_intervention" )
381385 else :
0 commit comments