aboutsummaryrefslogtreecommitdiffstats
path: root/node/errors.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-08-23 18:36:11 +0800
committerGitHub <noreply@github.com>2017-08-23 18:36:11 +0800
commitf7e39a772497f96253071da873d7d9923a3ed719 (patch)
tree64f5df5d38f520edb544b3cc98b0cd2f54b5b3ce /node/errors.go
parent79cdbcfe646be0d8f41111f80fdea41cda0f0104 (diff)
parent7e57fee3551ad5b66c985ad208613fd80c2d6b8a (diff)
downloaddexon-f7e39a772497f96253071da873d7d9923a3ed719.tar
dexon-f7e39a772497f96253071da873d7d9923a3ed719.tar.gz
dexon-f7e39a772497f96253071da873d7d9923a3ed719.tar.bz2
dexon-f7e39a772497f96253071da873d7d9923a3ed719.tar.lz
dexon-f7e39a772497f96253071da873d7d9923a3ed719.tar.xz
dexon-f7e39a772497f96253071da873d7d9923a3ed719.tar.zst
dexon-f7e39a772497f96253071da873d7d9923a3ed719.zip
Merge pull request #15000 from fjl/node-flock
node: fix instance dir locking and improve error message
Diffstat (limited to 'node/errors.go')
-rw-r--r--node/errors.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/node/errors.go b/node/errors.go
index bd5ddeb5d..2e0dadc4d 100644
--- a/node/errors.go
+++ b/node/errors.go
@@ -17,10 +17,28 @@
package node
import (
+ "errors"
"fmt"
"reflect"
+ "syscall"
)
+var (
+ ErrDatadirUsed = errors.New("datadir already used by another process")
+ ErrNodeStopped = errors.New("node not started")
+ ErrNodeRunning = errors.New("node already running")
+ ErrServiceUnknown = errors.New("unknown service")
+
+ datadirInUseErrnos = map[uint]bool{11: true, 32: true, 35: true}
+)
+
+func convertFileLockError(err error) error {
+ if errno, ok := err.(syscall.Errno); ok && datadirInUseErrnos[uint(errno)] {
+ return ErrDatadirUsed
+ }
+ return err
+}
+
// DuplicateServiceError is returned during Node startup if a registered service
// constructor returns a service of the same type that was already started.
type DuplicateServiceError struct {