-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.go
38 lines (30 loc) · 1.01 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
34
35
36
37
38
package types
import (
"errors"
"fmt"
)
var (
ErrEmptyRoutes = errors.New("provided empty routes")
ErrInvalidPool = errors.New("attempting to create an invalid pool")
ErrTooFewPoolAssets = errors.New("pool should have at least 2 assets, as they must be swapping between at least two assets")
ErrTooManyPoolAssets = errors.New("pool has too many assets (currently capped at 8 assets per pool)")
)
type nonPositiveAmountError struct {
Amount string
}
func (e nonPositiveAmountError) Error() string {
return fmt.Sprintf("min out amount or max in amount should be positive, was (%s)", e.Amount)
}
type FailedToFindRouteError struct {
PoolId uint64
}
func (e FailedToFindRouteError) Error() string {
return fmt.Sprintf("failed to find route for pool id (%d)", e.PoolId)
}
type UndefinedRouteError struct {
PoolType PoolType
PoolId uint64
}
func (e UndefinedRouteError) Error() string {
return fmt.Sprintf("route is not defined for the given pool type (%s) and pool id (%d)", e.PoolType, e.PoolId)
}