Skip to content

Commit

Permalink
[FAB-5908] Remove transaction proposal from error
Browse files Browse the repository at this point in the history
Change-Id: I8c1f33c488ab7b8d21242770adf804c5f6ccfbcd
Signed-off-by: Divyank Katira <Divyank.Katira@securekey.com>
  • Loading branch information
d1vyank committed Aug 24, 2017
1 parent 110bf21 commit 4bea613
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion pkg/fabric-client/peer/peerendorser.go
Expand Up @@ -107,5 +107,6 @@ func (p *peerEndorser) sendProposal(proposal apitxn.TransactionProposal) (*pb.Pr
}

func (tpe TransactionProposalError) Error() string {
return fmt.Sprintf("Transaction processor (%s) returned error '%s' for proposal: %v", tpe.Endorser, tpe.Err.Error(), tpe.Proposal)
return fmt.Sprintf("Transaction processor (%s) returned error '%s' for txID '%s'",
tpe.Endorser, tpe.Err.Error(), tpe.Proposal.TxnID.ID)
}
6 changes: 3 additions & 3 deletions pkg/fabric-client/peer/peerendorser_test.go
Expand Up @@ -11,6 +11,7 @@ import (
"fmt"
"net"
"reflect"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -265,17 +266,16 @@ func startEndorserServer(t *testing.T, grpcServer *grpc.Server) (*mocks.MockEndo
func TestTransactionProposalError(t *testing.T) {
var mockError error

proposal := mockTransactionProposal()
mockError = TransactionProposalError{
Endorser: "1.2.3.4:1000",
Proposal: mockTransactionProposal(),
Err: fmt.Errorf("error"),
}

errText := mockError.Error()
mockText := fmt.Sprintf("Transaction processor (1.2.3.4:1000) returned error 'error' for proposal: %v", proposal)
mockText := "Transaction processor (1.2.3.4:1000) returned error 'error'"

if errText != mockText {
if !strings.Contains(errText, mockText) {
t.Fatalf("Unexpected error")
}
}

0 comments on commit 4bea613

Please sign in to comment.