15
15
*/
16
16
package com .uber .cadence .internal .compatibility .thrift ;
17
17
18
- import com .uber .cadence .*;
19
18
import com .uber .cadence .AccessDeniedError ;
19
+ import com .uber .cadence .CancellationAlreadyRequestedError ;
20
+ import com .uber .cadence .ClientVersionNotSupportedError ;
21
+ import com .uber .cadence .DomainAlreadyExistsError ;
22
+ import com .uber .cadence .DomainNotActiveError ;
20
23
import com .uber .cadence .EntityNotExistsError ;
24
+ import com .uber .cadence .FeatureNotEnabledError ;
25
+ import com .uber .cadence .InternalDataInconsistencyError ;
21
26
import com .uber .cadence .InternalServiceError ;
27
+ import com .uber .cadence .WorkflowExecutionAlreadyCompletedError ;
28
+ import com .uber .cadence .WorkflowExecutionAlreadyStartedError ;
22
29
import io .grpc .Metadata ;
23
30
import io .grpc .StatusRuntimeException ;
24
31
import org .apache .thrift .TException ;
@@ -32,30 +39,42 @@ public static TException Error(StatusRuntimeException ex) {
32
39
return new AccessDeniedError (ex .getMessage ());
33
40
case INTERNAL :
34
41
return new InternalServiceError (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 ());
42
+ case NOT_FOUND : {
43
+ switch (details ) {
44
+ case "EntityNotExistsError" :
45
+ // TODO add cluster info
46
+ return new EntityNotExistsError (ex .getMessage ());
47
+ case "WorkflowExecutionAlreadyCompletedError" :
48
+ return new WorkflowExecutionAlreadyCompletedError (ex .getMessage ());
49
+ }
50
+ }
51
+ case ALREADY_EXISTS : {
52
+ switch (details ) {
53
+ case "CancellationAlreadyRequestedError" :
54
+ return new CancellationAlreadyRequestedError (ex .getMessage ());
55
+ case "DomainAlreadyExistsError" :
56
+ return new DomainAlreadyExistsError (ex .getMessage ());
57
+ case "WorkflowExecutionAlreadyStartedError" : {
58
+ // TODO add started wf info
59
+ WorkflowExecutionAlreadyStartedError e = new WorkflowExecutionAlreadyStartedError ();
60
+ e .setMessage (ex .getMessage ());
61
+ return e ;
43
62
}
44
63
}
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
- }
64
+ }
65
+ case DATA_LOSS :
66
+ return new InternalDataInconsistencyError ( ex . getMessage ());
67
+ case FAILED_PRECONDITION :
68
+ switch ( details ) {
69
+ // TODO add infos
70
+ case "ClientVersionNotSupportedError" :
71
+ return new ClientVersionNotSupportedError ();
72
+ case "FeatureNotEnabledError" :
73
+ return new FeatureNotEnabledError ();
74
+ case "DomainNotActiveError" : {
75
+ DomainNotActiveError e = new DomainNotActiveError ( );
76
+ e . setMessage ( ex . getMessage ()) ;
77
+ return e ;
59
78
}
60
79
}
61
80
default :
0 commit comments