Improve no such node error messages

This commit is contained in:
Jakob Borg 2013-12-30 20:55:33 -05:00
parent af3e64a5a7
commit 2f660aff7a
2 changed files with 2 additions and 7 deletions

View File

@ -12,7 +12,6 @@ acquire locks, but document what locks they require.
*/ */
import ( import (
"errors"
"fmt" "fmt"
"os" "os"
"path" "path"
@ -40,10 +39,6 @@ type Model struct {
lastIdxBcastRequest time.Time lastIdxBcastRequest time.Time
} }
var (
errNoSuchNode = errors.New("no such node")
)
const ( const (
FlagDeleted = 1 << 12 FlagDeleted = 1 << 12
@ -231,7 +226,7 @@ func (m *Model) RequestGlobal(nodeID, name string, offset uint64, size uint32, h
nc, ok := m.nodes[nodeID] nc, ok := m.nodes[nodeID]
m.RUnlock() m.RUnlock()
if !ok { if !ok {
return nil, errNoSuchNode return nil, fmt.Errorf("RequestGlobal: no such node: %s", nodeID)
} }
if opts.Debug.TraceNet { if opts.Debug.TraceNet {

View File

@ -34,7 +34,7 @@ func (m *Model) pullFile(name string) error {
m.RUnlock() m.RUnlock()
if len(nodeIDs) == 0 { if len(nodeIDs) == 0 {
return errNoSuchNode return fmt.Errorf("%s: no connected nodes with file available", name)
} }
filename := path.Join(m.dir, name) filename := path.Join(m.dir, name)