You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by xu...@apache.org on 2026/08/10 13:08:17 UTC

(dubbo-go) branch develop updated: fix(protocol/triple): return standard errors in SetHeader, SetTrailer, SendHeader (#3633)

This is an automated email from the ASF dual-hosted git repository.

Alanxtl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git


The following commit(s) were added to refs/heads/develop by this push:
     new 8b14fdadc fix(protocol/triple): return standard errors in SetHeader, SetTrailer, SendHeader (#3633)
8b14fdadc is described below

commit 8b14fdadc63fd320e30488ab65aa95169fab6a80
Author: Yash Israni <11...@users.noreply.github.com>
AuthorDate: Mon Aug 10 18:38:12 2026 +0530

    fix(protocol/triple): return standard errors in SetHeader, SetTrailer, SendHeader (#3633)
    
    * fix(protocol/triple): return standard errors in SetHeader, SetTrailer, SendHeader
    
    Signed-off-by: Yash Israni <11...@users.noreply.github.com>
    
    * Update protocol/triple/triple_protocol/header.go
    
    Co-authored-by: Xuetao Li <xu...@apache.org>
    
    * Update protocol/triple/triple_protocol/header.go
    
    Co-authored-by: Xuetao Li <xu...@apache.org>
    
    * Update protocol/triple/triple_protocol/header.go
    
    Co-authored-by: Xuetao Li <xu...@apache.org>
    
    ---------
    
    Signed-off-by: Yash Israni <11...@users.noreply.github.com>
    Co-authored-by: Xuetao Li <xu...@apache.org>
---
 protocol/triple/triple_protocol/header.go | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/protocol/triple/triple_protocol/header.go b/protocol/triple/triple_protocol/header.go
index 35b12ca1c..76ac92505 100644
--- a/protocol/triple/triple_protocol/header.go
+++ b/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; SetHeader must be called within a Triple handler")
 	}
 	mergeHeaders(conn.ResponseHeader(), header)
 	return nil
@@ -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; SetTrailer must be called within a Triple handler")
 	}
 	mergeHeaders(conn.ResponseTrailer(), trailer)
 	return nil
@@ -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; SendHeader must be called within a Triple handler")
 	}
 	mergeHeaders(conn.RequestHeader(), header)
 	return conn.Send(nil)