Răsfoiți Sursa

Return full error context from ContextualError.Error() (#1069)

brad-defined 1 an în urmă
părinte
comite
e3f5a129c1
1 a modificat fișierele cu 2 adăugiri și 1 ștergeri
  1. 2 1
      util/error.go

+ 2 - 1
util/error.go

@@ -2,6 +2,7 @@ package util
 
 
 import (
 import (
 	"errors"
 	"errors"
+	"fmt"
 
 
 	"github.com/sirupsen/logrus"
 	"github.com/sirupsen/logrus"
 )
 )
@@ -40,7 +41,7 @@ func (ce *ContextualError) Error() string {
 	if ce.RealError == nil {
 	if ce.RealError == nil {
 		return ce.Context
 		return ce.Context
 	}
 	}
-	return ce.RealError.Error()
+	return fmt.Errorf("%s (%v): %w", ce.Context, ce.Fields, ce.RealError).Error()
 }
 }
 
 
 func (ce *ContextualError) Unwrap() error {
 func (ce *ContextualError) Unwrap() error {