Skip to content

Commit

Permalink
add comment and remove redundant statement
Browse files Browse the repository at this point in the history
  • Loading branch information
DMwangnima committed Oct 10, 2024
1 parent af60997 commit af4000f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions pkg/streamx/provider/ttstream/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,11 @@ func (s *stream) readTrailerFrame(fr *Frame) (err error) {
return fmt.Errorf("stream read a unexcept trailer")
}

// when server-side returns non-biz error, it will be wrapped as ApplicationException stored in trailer frame payload
if len(fr.payload) > 0 {
_, _, ex := thrift.UnmarshalFastMsg(fr.payload, nil)
s.err = ex.(*thrift.ApplicationException)
} else {
} else { // when server-side returns biz error, payload is empty and biz error information is stored in trailer frame header
bizErr, err := transmeta.ParseBizStatusErr(fr.trailer)
if err != nil {
s.err = err
Expand Down Expand Up @@ -207,9 +208,6 @@ func (s *stream) appendTrailer(kvs ...string) (err error) {
if len(kvs)%2 != 0 {
return fmt.Errorf("got the odd number of input kvs for Trailer: %d", len(kvs))
}
if s.wtrailer == nil {
s.wtrailer = make(streamx.Trailer)
}
var key string
for i, str := range kvs {
if i%2 == 0 {
Expand Down

0 comments on commit af4000f

Please sign in to comment.