-
Notifications
You must be signed in to change notification settings - Fork 2
/
errors.go
33 lines (26 loc) · 1.22 KB
/
errors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package sacco
import "fmt"
// ErrDerivationPathShort represents an error that happens when the derivation path
// is too short.
var ErrDerivationPathShort = fmt.Errorf("derivation path string too short")
// ErrDerivationPathFirstCharNotM happens whenever the derivation path string doesn't
// begin with "m".
var ErrDerivationPathFirstCharNotM = fmt.Errorf("derivation path invalid, first character isn't 'm'")
// ErrComponentNaN happens when a component of a derivation path
// isn't a number.
var ErrComponentNaN = func(component string, err error) error {
return fmt.Errorf("derivation component \"%s\" not a number: %w", component, err)
}
// ErrKeyGeneration represents an error thrown when there was some kind of
// error while generating a key.
var ErrKeyGeneration = func(err error) error {
return fmt.Errorf("cannot derive key: %w", err)
}
// ErrCouldNotNeuter happens when neutering a key is not possible.
var ErrCouldNotNeuter = func(err error) error {
return fmt.Errorf("could not derive neutered public key: %w", err)
}
// ErrCouldNotNeuter happens when converting a public key to bech32 is impossible.
var ErrCouldNotBech32 = func(err error) error {
return fmt.Errorf("could not convert public key to bech32: %w", err)
}