@@ -469,29 +469,24 @@ impl MutableFinalize for HistoryForReplayTunnelHandle {}
469469////////////////////////////////////////////////////////////////////////////////////////////////////
470470
471471mod config {
472- use std:: collections:: HashSet ;
472+ use super :: custom_slot_supplier:: CustomSlotSupplierOptions ;
473+ use crate :: helpers:: TryIntoJs ;
474+ use bridge_macros:: TryFromJs ;
475+ use neon:: context:: Context ;
476+ use neon:: object:: Object ;
477+ use neon:: prelude:: JsResult ;
478+ use neon:: types:: JsObject ;
479+ use std:: collections:: { HashMap , HashSet } ;
473480 use std:: { sync:: Arc , time:: Duration } ;
474481 use temporalio_common:: protos:: temporal:: api:: enums:: v1:: VersioningBehavior as CoreVersioningBehavior ;
475482 use temporalio_common:: protos:: temporal:: api:: worker:: v1:: PluginInfo ;
483+ use temporalio_common:: worker:: WorkerVersioningStrategy ;
476484 use temporalio_common:: worker:: {
477485 ActivitySlotKind , LocalActivitySlotKind , NexusSlotKind ,
478486 PollerBehavior as CorePollerBehavior , SlotKind , WorkerConfig , WorkerConfigBuilder ,
479487 WorkerConfigBuilderError , WorkerDeploymentOptions as CoreWorkerDeploymentOptions ,
480488 WorkerDeploymentVersion as CoreWorkerDeploymentVersion , WorkflowSlotKind ,
481489 } ;
482- use temporalio_sdk_core:: {
483- ResourceBasedSlotsOptions , ResourceBasedSlotsOptionsBuilder , ResourceSlotOptions ,
484- SlotSupplierOptions as CoreSlotSupplierOptions , TunerHolder , TunerHolderOptionsBuilder ,
485- } ;
486-
487- use super :: custom_slot_supplier:: CustomSlotSupplierOptions ;
488- use crate :: helpers:: TryIntoJs ;
489- use bridge_macros:: TryFromJs ;
490- use neon:: context:: Context ;
491- use neon:: object:: Object ;
492- use neon:: prelude:: JsResult ;
493- use neon:: types:: JsObject ;
494- use temporalio_common:: worker:: WorkerVersioningStrategy ;
495490
496491 #[ derive( TryFromJs ) ]
497492 pub struct BridgeWorkerOptions {
@@ -515,6 +510,8 @@ mod config {
515510 max_task_queue_activities_per_second : Option < f64 > ,
516511 shutdown_grace_time : Option < Duration > ,
517512 plugins : Vec < String > ,
513+ workflow_failure_errors : HashSet < WorkflowErrorType > ,
514+ workflow_types_to_failure_errors : HashMap < String , HashSet < WorkflowErrorType > > ,
518515 }
519516
520517 #[ derive( TryFromJs ) ]
@@ -611,6 +608,10 @@ mod config {
611608 } )
612609 . collect :: < HashSet < _ > > ( ) ,
613610 )
611+ . workflow_failure_errors ( into_core_workflow_error_set ( self . workflow_failure_errors ) )
612+ . workflow_types_to_failure_errors ( into_core_workflow_error_map_of_sets (
613+ self . workflow_types_to_failure_errors ,
614+ ) )
614615 . build ( )
615616 }
616617 }
@@ -682,6 +683,33 @@ mod config {
682683 }
683684 }
684685
686+ #[ derive( TryFromJs , Hash , Eq , PartialEq ) ]
687+ pub enum WorkflowErrorType {
688+ Nondeterminism ,
689+ }
690+
691+ impl From < WorkflowErrorType > for CoreWorkflowErrorType {
692+ fn from ( val : WorkflowErrorType ) -> Self {
693+ match val {
694+ WorkflowErrorType :: Nondeterminism => Self :: Nondeterminism ,
695+ }
696+ }
697+ }
698+
699+ fn into_core_workflow_error_set (
700+ val : HashSet < WorkflowErrorType > ,
701+ ) -> HashSet < CoreWorkflowErrorType > {
702+ val. into_iter ( ) . map ( Into :: into) . collect ( )
703+ }
704+
705+ fn into_core_workflow_error_map_of_sets (
706+ val : HashMap < String , HashSet < WorkflowErrorType > > ,
707+ ) -> HashMap < String , HashSet < CoreWorkflowErrorType > > {
708+ val. into_iter ( )
709+ . map ( |( k, v) | ( k, into_core_workflow_error_set ( v) ) )
710+ . collect ( )
711+ }
712+
685713 #[ derive( TryFromJs ) ]
686714 #[ allow( clippy:: struct_field_names) ]
687715 pub ( super ) struct WorkerTuner {
0 commit comments