gRPC migration
Change-Id: I3129ae27d7ee12a23c7046f0d877e8064f2fd7f4
diff --git a/vendor/github.com/uber/jaeger-client-go/thrift/protocol_exception.go b/vendor/github.com/uber/jaeger-client-go/thrift/protocol_exception.go
index 6e357ee..9dcf4bf 100644
--- a/vendor/github.com/uber/jaeger-client-go/thrift/protocol_exception.go
+++ b/vendor/github.com/uber/jaeger-client-go/thrift/protocol_exception.go
@@ -21,6 +21,7 @@
import (
"encoding/base64"
+ "errors"
)
// Thrift Protocol exception
@@ -40,8 +41,15 @@
)
type tProtocolException struct {
- typeId int
- message string
+ typeId int
+ err error
+ msg string
+}
+
+var _ TProtocolException = (*tProtocolException)(nil)
+
+func (tProtocolException) TExceptionType() TExceptionType {
+ return TExceptionTypeProtocol
}
func (p *tProtocolException) TypeId() int {
@@ -49,30 +57,48 @@
}
func (p *tProtocolException) String() string {
- return p.message
+ return p.msg
}
func (p *tProtocolException) Error() string {
- return p.message
+ return p.msg
+}
+
+func (p *tProtocolException) Unwrap() error {
+ return p.err
}
func NewTProtocolException(err error) TProtocolException {
if err == nil {
return nil
}
- if e,ok := err.(TProtocolException); ok {
+
+ if e, ok := err.(TProtocolException); ok {
return e
}
- if _, ok := err.(base64.CorruptInputError); ok {
- return &tProtocolException{INVALID_DATA, err.Error()}
+
+ if errors.As(err, new(base64.CorruptInputError)) {
+ return NewTProtocolExceptionWithType(INVALID_DATA, err)
}
- return &tProtocolException{UNKNOWN_PROTOCOL_EXCEPTION, err.Error()}
+
+ return NewTProtocolExceptionWithType(UNKNOWN_PROTOCOL_EXCEPTION, err)
}
func NewTProtocolExceptionWithType(errType int, err error) TProtocolException {
if err == nil {
return nil
}
- return &tProtocolException{errType, err.Error()}
+ return &tProtocolException{
+ typeId: errType,
+ err: err,
+ msg: err.Error(),
+ }
}
+func prependTProtocolException(prepend string, err TProtocolException) TProtocolException {
+ return &tProtocolException{
+ typeId: err.TypeId(),
+ err: err,
+ msg: prepend + err.Error(),
+ }
+}