forked from Ecwid/control
-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.go
68 lines (53 loc) · 1.72 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package control
import (
"errors"
"fmt"
"time"
"github.com/ecwid/control/protocol/common"
"github.com/ecwid/control/protocol/target"
)
var (
ErrNodeIsNotVisible = errors.New("node is not visible")
ErrNodeIsOutOfViewport = errors.New("node is out of viewport")
ErrAlreadyNavigated = errors.New("page already navigated to this address - nothing done")
ErrTargetDestroyed = errors.New("this session was destroyed")
ErrDetachedFromTarget = errors.New("detached from target")
ErrClickTimeout = errors.New("no click registered")
ErrExecutionContextDestroyed = errors.New("execution context was destroyed")
)
type ErrTargetCrashed target.TargetCrashed
func (e ErrTargetCrashed) Error() string {
return fmt.Sprintf("TargetID = %s, ErrorCode = %d, Status = %s", e.TargetId, e.ErrorCode, e.Status)
}
type NoSuchElementError struct {
Selector string
}
func (n NoSuchElementError) Error() string {
return fmt.Sprintf("no such element `%s`", n.Selector)
}
type NoSuchFrameError struct {
id common.FrameId
}
func (n NoSuchFrameError) Error() string {
return fmt.Sprintf("no such frame `%s`", n.id)
}
type RemoteObjectCastError struct {
object primitiveRemoteObject
cast string
}
func (r RemoteObjectCastError) Error() string {
return fmt.Sprintf("cast to `%s` failed for value `%s`", r.cast, r.object.Type)
}
type FutureTimeoutError struct {
timeout time.Duration
}
func (e FutureTimeoutError) Error() string {
return fmt.Sprintf("future timeout has expired (%s)", e.timeout)
}
type ClickTargetOverlappedError struct {
X, Y float64
outerHTML string
}
func (e ClickTargetOverlappedError) Error() string {
return fmt.Sprintf("click at target is overlapped by `%s`", e.outerHTML)
}