@@ -140,7 +140,7 @@ func TestDefaultErrorHandler(t *testing.T) {
140140 reqCtx := rpcinfo .NewCtxWithRPCInfo (context .Background (), ri )
141141
142142 // Test TApplicationException
143- err := DefaultClientErrorHandler (context . Background () , thrift .NewTApplicationException (100 , "mock" ))
143+ err := DefaultClientErrorHandler (reqCtx , thrift .NewTApplicationException (100 , "mock" ))
144144 test .Assert (t , err .Error () == "remote or network error[remote]: mock" , err .Error ())
145145 var te thrift.TApplicationException
146146 ok := errors .As (err , & te )
@@ -154,7 +154,7 @@ func TestDefaultErrorHandler(t *testing.T) {
154154 test .Assert (t , te .TypeId () == 100 )
155155
156156 // Test PbError
157- err = DefaultClientErrorHandler (context . Background () , protobuf .NewPbError (100 , "mock" ))
157+ err = DefaultClientErrorHandler (reqCtx , protobuf .NewPbError (100 , "mock" ))
158158 test .Assert (t , err .Error () == "remote or network error[remote]: mock" )
159159 var pe protobuf.PBError
160160 ok = errors .As (err , & pe )
@@ -168,18 +168,25 @@ func TestDefaultErrorHandler(t *testing.T) {
168168 test .Assert (t , te .TypeId () == 100 )
169169
170170 // Test status.Error
171- err = DefaultClientErrorHandler (context . Background () , status .Err (100 , "mock" ))
171+ err = DefaultClientErrorHandler (reqCtx , status .Err (100 , "mock" ))
172172 test .Assert (t , err .Error () == "remote or network error: rpc error: code = 100 desc = mock" , err .Error ())
173173 // Test status.Error with remote addr
174174 err = ClientErrorHandlerWithAddr (reqCtx , status .Err (100 , "mock" ))
175175 test .Assert (t , err .Error () == "remote or network error[" + tcpAddrStr + "]: rpc error: code = 100 desc = mock" , err .Error ())
176176
177177 // Test other error
178- err = DefaultClientErrorHandler (context . Background () , errors .New ("mock" ))
178+ err = DefaultClientErrorHandler (reqCtx , errors .New ("mock" ))
179179 test .Assert (t , err .Error () == "remote or network error: mock" )
180180 // Test other error with remote addr
181181 err = ClientErrorHandlerWithAddr (reqCtx , errors .New ("mock" ))
182182 test .Assert (t , err .Error () == "remote or network error[" + tcpAddrStr + "]: mock" )
183+
184+ // Test BizStatusError set
185+ ri .Invocation ().(rpcinfo.InvocationSetter ).SetBizStatusErr (kerrors .NewBizStatusError (1024 , "biz" ))
186+ err = DefaultClientErrorHandler (reqCtx , errors .New ("mock" ))
187+ err , ok = kerrors .FromBizStatusError (err )
188+ test .Assert (t , ok , "should return BizStatusError here" )
189+ test .Assert (t , err .Error () == "biz error: code=1024, msg=biz" , err .Error ())
183190}
184191
185192func TestNewProxyMW (t * testing.T ) {
0 commit comments