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() {
341
341
details == null ? new EncodedValues (null ) : details ,
342
342
cause ,
343
343
nextRetryDelay ,
344
- category );
344
+ category == null ? ApplicationErrorCategory . UNSPECIFIED : category );
345
345
}
346
346
}
347
347
}
Original file line number Diff line number Diff line change @@ -244,15 +244,17 @@ private Failure exceptionToFailure(Throwable throwable) {
244
244
ApplicationFailureInfo .Builder info =
245
245
ApplicationFailureInfo .newBuilder ()
246
246
.setType (ae .getType ())
247
- .setNonRetryable (ae .isNonRetryable ())
248
- .setCategory (FailureUtils .categoryToProto (ae .getCategory ()));
247
+ .setNonRetryable (ae .isNonRetryable ());
249
248
Optional <Payloads > details = ((EncodedValues ) ae .getDetails ()).toPayloads ();
250
249
if (details .isPresent ()) {
251
250
info .setDetails (details .get ());
252
251
}
253
252
if (ae .getNextRetryDelay () != null ) {
254
253
info .setNextRetryDelay (ProtobufTimeUtils .toProtoDuration (ae .getNextRetryDelay ()));
255
254
}
255
+ if (ae .getCategory () != null ) {
256
+ info .setCategory (FailureUtils .categoryToProto (ae .getCategory ()));
257
+ }
256
258
failure .setApplicationFailureInfo (info );
257
259
} else if (throwable instanceof TimeoutFailure ) {
258
260
TimeoutFailure te = (TimeoutFailure ) throwable ;
Original file line number Diff line number Diff line change @@ -89,7 +89,10 @@ public static class TestActivityImpl implements TestActivity {
89
89
@ Override
90
90
public void execute (boolean isBenign ) {
91
91
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 ();
93
96
} else {
94
97
throw ApplicationFailure .newBuilder ()
95
98
.setMessage ("Benign activity failure" )
You can’t perform that action at this time.
0 commit comments