Improved error message in ECClient (#214)

* Improved error message in ECClient

* Fixed broken test
This commit is contained in:
Kaloyan Raev 2018-08-10 12:14:23 +03:00 committed by GitHub
parent 5f8142cdcc
commit ffaebb57df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -62,7 +62,8 @@ func (ec *ecClient) Put(ctx context.Context, nodes []*proto.Node, rs eestream.Re
pieceID client.PieceID, data io.Reader, expiration time.Time) (err error) {
defer mon.Task()(&ctx)(&err)
if len(nodes) != rs.TotalCount() {
return Error.New("number of nodes do not match total count of erasure scheme")
return Error.New("number of nodes (%d) do not match total count (%d) of erasure scheme",
len(nodes), rs.TotalCount())
}
if !unique(nodes) {
return Error.New("duplicated nodes are not allowed")

View File

@ -124,8 +124,8 @@ TestLoop:
errs []error
errString string
}{
{[]*proto.Node{}, 0, 0, true, []error{}, "ecclient error: " +
"number of nodes do not match total count of erasure scheme"},
{[]*proto.Node{}, 0, 0, true, []error{},
fmt.Sprintf("ecclient error: number of nodes (0) do not match total count (%d) of erasure scheme", n)},
{[]*proto.Node{node0, node1, node2, node3}, 0, -1, true,
[]error{nil, nil, nil, nil},
"eestream error: negative max buffer memory"},