Skip to content

Commit

Permalink
Merge "FAB-16483 Improve error message" into release-1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
ale-linux authored and Gerrit Code Review committed Sep 26, 2019
2 parents 19c2829 + cdaa9dd commit b6fdef9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions orderer/common/msgprocessor/standardchannel.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,14 @@ func (s *StandardChannel) ProcessNormalMsg(env *cb.Envelope) (configSeq uint64,
// return the resulting config message and the configSeq the config was computed from. If the config impetus message
// is invalid, an error is returned.
func (s *StandardChannel) ProcessConfigUpdateMsg(env *cb.Envelope) (config *cb.Envelope, configSeq uint64, err error) {
logger.Debugf("Processing config update message for channel %s", s.support.ChainID())
logger.Debugf("Processing config update message for exisitng channel %s", s.support.ChainID())

// Call Sequence first. If seq advances between proposal and acceptance, this is okay, and will cause reprocessing
// however, if Sequence is called last, then a success could be falsely attributed to a newer configSeq
seq := s.support.Sequence()
err = s.filters.Apply(env)
if err != nil {
return nil, 0, err
return nil, 0, errors.WithMessage(err, "config update for existing channel did not pass initial checks")
}

configEnvelope, err := s.support.ProposeConfigUpdate(env)
Expand All @@ -138,12 +138,12 @@ func (s *StandardChannel) ProcessConfigUpdateMsg(env *cb.Envelope) (config *cb.E
// check is negligible, as this is the reconfig path and not the normal path.
err = s.filters.Apply(config)
if err != nil {
return nil, 0, err
return nil, 0, errors.WithMessage(err, "config update for existing channel did not pass final checks")
}

err = s.maintenanceFilter.Apply(config)
if err != nil {
return nil, 0, err
return nil, 0, errors.WithMessage(err, "config update for existing channel did not pass maintenance checks")
}

return config, seq, nil
Expand Down
3 changes: 2 additions & 1 deletion orderer/common/msgprocessor/systemchannel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
genesisconfig "github.com/hyperledger/fabric/common/tools/configtxgen/localconfig"
cb "github.com/hyperledger/fabric/protos/common"
"github.com/hyperledger/fabric/protos/utils"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -223,7 +224,7 @@ func TestSystemChannelConfigUpdateMsg(t *testing.T) {
},
}),
})
assert.Equal(t, RejectRule.Apply(nil), err)
assert.Equal(t, RejectRule.Apply(nil), errors.Cause(err))
})
t.Run("Good", func(t *testing.T) {
mscs := &mockSystemChannelSupport{
Expand Down

0 comments on commit b6fdef9

Please sign in to comment.