15
15
*/
16
16
package com .uber .cadence .internal .compatibility .thrift ;
17
17
18
+ import com .uber .cadence .*;
18
19
import com .uber .cadence .AccessDeniedError ;
19
20
import com .uber .cadence .EntityNotExistsError ;
20
21
import com .uber .cadence .InternalServiceError ;
21
- import com .uber .cadence .WorkflowExecutionAlreadyCompletedError ;
22
22
import io .grpc .Metadata ;
23
23
import io .grpc .StatusRuntimeException ;
24
24
import org .apache .thrift .TException ;
@@ -32,15 +32,32 @@ public static TException Error(StatusRuntimeException ex) {
32
32
return new AccessDeniedError (ex .getMessage ());
33
33
case INTERNAL :
34
34
return new InternalServiceError (ex .getMessage ());
35
- case NOT_FOUND : {
36
- switch (details ) {
37
- case "EntityNotExistsError" :
38
- // TODO add cluster info
39
- return new EntityNotExistsError (ex .getMessage ());
40
- case "WorkflowExecutionAlreadyCompletedError" :
41
- return new WorkflowExecutionAlreadyCompletedError (ex .getMessage ());
35
+ case NOT_FOUND :
36
+ {
37
+ switch (details ) {
38
+ case "EntityNotExistsError" :
39
+ // TODO add cluster info
40
+ return new EntityNotExistsError (ex .getMessage ());
41
+ case "WorkflowExecutionAlreadyCompletedError" :
42
+ return new WorkflowExecutionAlreadyCompletedError (ex .getMessage ());
43
+ }
44
+ }
45
+ case ALREADY_EXISTS :
46
+ {
47
+ switch (details ) {
48
+ case "CancellationAlreadyRequestedError" :
49
+ return new CancellationAlreadyRequestedError (ex .getMessage ());
50
+ case "DomainAlreadyExistsError" :
51
+ return new DomainAlreadyExistsError (ex .getMessage ());
52
+ case "WorkflowExecutionAlreadyStartedError" :
53
+ {
54
+ // TODO add started wf info
55
+ WorkflowExecutionAlreadyStartedError e = new WorkflowExecutionAlreadyStartedError ();
56
+ e .setMessage (ex .getMessage ());
57
+ return e ;
58
+ }
59
+ }
42
60
}
43
- }
44
61
default :
45
62
// If error does not match anything, return raw grpc status error
46
63
// There are some code that casts error to grpc status to check for deadline exceeded status
0 commit comments