File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -621,6 +621,10 @@ func (e *ChasmEngine) getExecutionLease(
621621 executionLease .GetReleaseFn ()(nil )
622622 err = staleReferenceErr
623623 }
624+ var notFound * serviceerror.NotFound
625+ if errors .As (err , & notFound ) {
626+ err = serviceerror .NewNotFoundf ("execution not found" )
627+ }
624628
625629 return shardContext , executionLease , err
626630}
Original file line number Diff line number Diff line change @@ -625,6 +625,31 @@ func (s *chasmEngineSuite) TestReadComponent_Success() {
625625 s .NoError (err )
626626}
627627
628+ // TestReadComponent_NotFound tests that ReadComponent returns an appropriate NotFound error message.
629+ func (s * chasmEngineSuite ) TestReadComponent_NotFound () {
630+ s .mockExecutionManager .EXPECT ().GetWorkflowExecution (gomock .Any (), gomock .Any ()).
631+ Return (nil , serviceerror .NewNotFound ("this error message will not be returned by ReadComponent" )).Times (1 )
632+
633+ err := s .engine .ReadComponent (
634+ context .Background (),
635+ chasm.NewComponentRef [* testComponent ](
636+ chasm.ExecutionKey {
637+ NamespaceID : string (tests .NamespaceID ),
638+ BusinessID : "non-existent-execution" ,
639+ RunID : "11111111-2222-3333-4444-555555555555" ,
640+ },
641+ ),
642+ func (ctx chasm.Context , component chasm.Component ) error {
643+ s .Fail ("readFn should not be called" )
644+ return nil
645+ },
646+ )
647+ s .Error (err )
648+ var notFound * serviceerror.NotFound
649+ s .ErrorAs (err , & notFound )
650+ s .Equal ("execution not found" , notFound .Message )
651+ }
652+
628653func (s * chasmEngineSuite ) buildPersistenceMutableState (
629654 key chasm.ExecutionKey ,
630655 componentState proto.Message ,
You can’t perform that action at this time.
0 commit comments