mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-02 11:58:28 +00:00
Improve no such node error messages
This commit is contained in:
parent
af3e64a5a7
commit
2f660aff7a
7
model.go
7
model.go
@ -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 {
|
||||||
|
@ -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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user