Alanxtl commented on code in PR #3633:
URL: https://github.com/apache/dubbo-go/pull/3633#discussion_r3746116217


##########
protocol/triple/triple_protocol/header.go:
##########
@@ -249,8 +249,7 @@ func FromIncomingContext(ctx context.Context) (http.Header, 
bool) {
 func SetHeader(ctx context.Context, header http.Header) error {
        conn, ok := ctx.Value(handlerOutgoingKey{}).(StreamingHandlerConn)
        if !ok {
-               // todo(DMwangnima): return standard error
-               return fmt.Errorf("triple: failed to fetch the connection from 
the context %v", ctx)
+               return errorf(CodeInternal, "triple: handler outgoing context 
not found, ensure this is called from within a Triple handler")

Review Comment:
   ```suggestion
                return errorf(CodeInternal, "triple: handler outgoing context 
not found; SetHeader must be called within a Triple handler")
   ```



##########
protocol/triple/triple_protocol/header.go:
##########
@@ -297,8 +295,7 @@ func SetTrailer(ctx context.Context, trailer http.Header) 
error {
 func SendHeader(ctx context.Context, header http.Header) error {
        conn, ok := ctx.Value(handlerOutgoingKey{}).(StreamingHandlerConn)
        if !ok {
-               // todo(DMwangnima): return standard error
-               return fmt.Errorf("triple: failed to fetch the connection from 
the context %v", ctx)
+               return errorf(CodeInternal, "triple: handler outgoing context 
not found, ensure this is called from within a Triple handler")

Review Comment:
   ```suggestion
                return errorf(CodeInternal, "triple: handler outgoing context 
not found; SendHeader must be called within a Triple handler")
   ```



##########
protocol/triple/triple_protocol/header.go:
##########
@@ -272,8 +271,7 @@ func SetHeader(ctx context.Context, header http.Header) 
error {
 func SetTrailer(ctx context.Context, trailer http.Header) error {
        conn, ok := ctx.Value(handlerOutgoingKey{}).(StreamingHandlerConn)
        if !ok {
-               // todo(DMwangnima): return standard error
-               return fmt.Errorf("triple: failed to fetch the connection from 
the context %v", ctx)
+               return errorf(CodeInternal, "triple: handler outgoing context 
not found, ensure this is called from within a Triple handler")

Review Comment:
   ```suggestion
                return errorf(CodeInternal, "triple: handler outgoing context 
not found; SetTrailer must be called within a Triple handler")
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to