Skip to content

Commit 8384052

Browse files
authored
Export Status method of ServiceError interface (#68)
1 parent cfb813c commit 8384052

21 files changed

+34
-34
lines changed

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ require (
88
github.com/gogo/status v1.1.0
99
github.com/golang/mock v1.4.4
1010
github.com/golang/protobuf v1.4.2 // indirect
11-
golang.org/x/net v0.0.0-20200822124328-c89045814202 // indirect
12-
golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a // indirect
11+
golang.org/x/net v0.0.0-20200904194848-62affa334b73 // indirect
12+
golang.org/x/sys v0.0.0-20200917073148-efd3b9a0ff20 // indirect
1313
golang.org/x/text v0.3.3 // indirect
14-
google.golang.org/genproto v0.0.0-20200831141814-d751682dd103 // indirect
15-
google.golang.org/grpc v1.31.1
14+
google.golang.org/genproto v0.0.0-20200917134801-bb4cff56e0d0 // indirect
15+
google.golang.org/grpc v1.32.0
1616
google.golang.org/protobuf v1.25.0 // indirect
1717
)

go.sum

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73r
5050
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
5151
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
5252
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
53-
golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA=
54-
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
53+
golang.org/x/net v0.0.0-20200904194848-62affa334b73 h1:MXfv8rhZWmFeqX3GNZRsd6vOLoaCHjYEX3qkRo3YBUA=
54+
golang.org/x/net v0.0.0-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
5555
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
5656
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
5757
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -61,8 +61,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h
6161
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
6262
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
6363
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
64-
golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a h1:i47hUS795cOydZI4AwJQCKXOr4BvxzvikwDoDtHhP2Y=
65-
golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
64+
golang.org/x/sys v0.0.0-20200917073148-efd3b9a0ff20 h1:4X356008q5SA3YXu8PiRap39KFmy4Lf6sGlceJKZQsU=
65+
golang.org/x/sys v0.0.0-20200917073148-efd3b9a0ff20/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
6666
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
6767
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
6868
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
@@ -81,15 +81,15 @@ google.golang.org/genproto v0.0.0-20180518175338-11a468237815/go.mod h1:JiN7NxoA
8181
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
8282
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
8383
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
84-
google.golang.org/genproto v0.0.0-20200831141814-d751682dd103 h1:z46CEPU+LlO0kGGwrH8h5epkkJhRZbAHYWOWD9JhLPI=
85-
google.golang.org/genproto v0.0.0-20200831141814-d751682dd103/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
84+
google.golang.org/genproto v0.0.0-20200917134801-bb4cff56e0d0 h1:uslsjIdqvZYANxSBQjTI47vZfwMaTN3mLELkMnMIY/A=
85+
google.golang.org/genproto v0.0.0-20200917134801-bb4cff56e0d0/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
8686
google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
8787
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
8888
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
8989
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
9090
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
91-
google.golang.org/grpc v1.31.1 h1:SfXqXS5hkufcdZ/mHtYCh53P2b+92WQq/DZcKLgsFRs=
92-
google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
91+
google.golang.org/grpc v1.32.0 h1:zWTV+LMdc3kaiJMSTOFz2UgSBgx8RNQoTGiZu3fR9S0=
92+
google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
9393
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
9494
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
9595
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=

serviceerror/canceled.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func (e *Canceled) Error() string {
4747
return e.Message
4848
}
4949

50-
func (e *Canceled) status() *status.Status {
50+
func (e *Canceled) Status() *status.Status {
5151
if e.st != nil {
5252
return e.st
5353
}

serviceerror/cancellationAlreadyRequested.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func (e *CancellationAlreadyRequested) Error() string {
4949
return e.Message
5050
}
5151

52-
func (e *CancellationAlreadyRequested) status() *status.Status {
52+
func (e *CancellationAlreadyRequested) Status() *status.Status {
5353
if e.st != nil {
5454
return e.st
5555
}

serviceerror/clientVersionNotSupported.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func (e *ClientVersionNotSupported) Error() string {
5757
return e.Message
5858
}
5959

60-
func (e *ClientVersionNotSupported) status() *status.Status {
60+
func (e *ClientVersionNotSupported) Status() *status.Status {
6161
if e.st != nil {
6262
return e.st
6363
}

serviceerror/convert.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ import (
3232
"go.temporal.io/api/errordetails/v1"
3333
)
3434

35-
// ToStatus converts service error to gogo gRPC status.
35+
// ToStatus converts service error to gogo gRPC Status.
3636
// If error is not a service error it returns status with code Unknown.
3737
func ToStatus(err error) *status.Status {
3838
if err == nil {
3939
return status.New(codes.OK, "")
4040
}
4141

4242
if svcerr, ok := err.(ServiceError); ok {
43-
return svcerr.status()
43+
return svcerr.Status()
4444
}
4545

4646
// Special case for context.DeadlineExceeded because it can happened in unpredictable places.
@@ -49,12 +49,12 @@ func ToStatus(err error) *status.Status {
4949
}
5050

5151
// Internal logic of status.Convert is:
52-
// - if err is already gogo Status or gRPC status, then just return it (this should never happen though).
52+
// - if err is already gogo Status or gRPC Status, then just return it (this should never happen though).
5353
// - otherwise returns codes.Unknown with message from err.Error() (this might happen if some generic go error reach to this point).
5454
return status.Convert(err)
5555
}
5656

57-
// FromStatus converts gogo gRPC status to service error.
57+
// FromStatus converts gogo gRPC Status to service error.
5858
func FromStatus(st *status.Status) error {
5959
if st == nil || st.Code() == codes.OK {
6060
return nil

serviceerror/dataLoss.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func (e *DataLoss) Error() string {
4747
return e.Message
4848
}
4949

50-
func (e *DataLoss) status() *status.Status {
50+
func (e *DataLoss) Status() *status.Status {
5151
if e.st != nil {
5252
return e.st
5353
}

serviceerror/deadlineExceeded.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func (e *DeadlineExceeded) Error() string {
4747
return e.Message
4848
}
4949

50-
func (e *DeadlineExceeded) status() *status.Status {
50+
func (e *DeadlineExceeded) Status() *status.Status {
5151
if e.st != nil {
5252
return e.st
5353
}

serviceerror/featureVersionNotSupported.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func (e *FeatureVersionNotSupported) Error() string {
5757
return e.Message
5858
}
5959

60-
func (e *FeatureVersionNotSupported) status() *status.Status {
60+
func (e *FeatureVersionNotSupported) Status() *status.Status {
6161
if e.st != nil {
6262
return e.st
6363
}

serviceerror/internal.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func (e *Internal) Error() string {
5454
return e.Message
5555
}
5656

57-
func (e *Internal) status() *status.Status {
57+
func (e *Internal) Status() *status.Status {
5858
if e.st != nil {
5959
return e.st
6060
}

0 commit comments

Comments
 (0)