File tree Expand file tree Collapse file tree 3 files changed +9
-4
lines changed
main/java/io/temporal/failure
test/java/io/temporal/internal/worker Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -341,7 +341,7 @@ public ApplicationFailure build() {
341341 details == null ? new EncodedValues (null ) : details ,
342342 cause ,
343343 nextRetryDelay ,
344- category );
344+ category == null ? ApplicationErrorCategory . UNSPECIFIED : category );
345345 }
346346 }
347347}
Original file line number Diff line number Diff line change @@ -244,15 +244,17 @@ private Failure exceptionToFailure(Throwable throwable) {
244244 ApplicationFailureInfo .Builder info =
245245 ApplicationFailureInfo .newBuilder ()
246246 .setType (ae .getType ())
247- .setNonRetryable (ae .isNonRetryable ())
248- .setCategory (FailureUtils .categoryToProto (ae .getCategory ()));
247+ .setNonRetryable (ae .isNonRetryable ());
249248 Optional <Payloads > details = ((EncodedValues ) ae .getDetails ()).toPayloads ();
250249 if (details .isPresent ()) {
251250 info .setDetails (details .get ());
252251 }
253252 if (ae .getNextRetryDelay () != null ) {
254253 info .setNextRetryDelay (ProtobufTimeUtils .toProtoDuration (ae .getNextRetryDelay ()));
255254 }
255+ if (ae .getCategory () != null ) {
256+ info .setCategory (FailureUtils .categoryToProto (ae .getCategory ()));
257+ }
256258 failure .setApplicationFailureInfo (info );
257259 } else if (throwable instanceof TimeoutFailure ) {
258260 TimeoutFailure te = (TimeoutFailure ) throwable ;
Original file line number Diff line number Diff line change @@ -89,7 +89,10 @@ public static class TestActivityImpl implements TestActivity {
8989 @ Override
9090 public void execute (boolean isBenign ) {
9191 if (!isBenign ) {
92- throw ApplicationFailure .newFailure ("Non-benign activity failure" , "NonBenignType" );
92+ throw ApplicationFailure .newBuilder ()
93+ .setMessage ("Non-benign activity failure" )
94+ .setType ("NonBenignType" )
95+ .build ();
9396 } else {
9497 throw ApplicationFailure .newBuilder ()
9598 .setMessage ("Benign activity failure" )
You can’t perform that action at this time.
0 commit comments