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 <[email protected]>
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 <[email protected]>
    
    * Update protocol/triple/triple_protocol/header.go
    
    Co-authored-by: Xuetao Li <[email protected]>
    
    * Update protocol/triple/triple_protocol/header.go
    
    Co-authored-by: Xuetao Li <[email protected]>
    
    * Update protocol/triple/triple_protocol/header.go
    
    Co-authored-by: Xuetao Li <[email protected]>
    
    ---------
    
    Signed-off-by: Yash Israni <[email protected]>
    Co-authored-by: Xuetao Li <[email protected]>
---
 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)

Reply via email to