/
errors.cr
53 lines (42 loc) · 1.23 KB
/
errors.cr
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
class LuckyFlow
# = LuckyFlow Errors
#
# Generic LuckyFlow exception class.
class Error < Exception
end
class NotSupportedByDriverError < Error
end
class NotSupportedByElementError < Error
end
class ElementNotFoundError < Error
def initialize(driver : LuckyFlow::Driver, selector : String, inner_text : String?)
message = LuckyFlow::ErrorMessageWhenNotFound.build(
driver: driver,
selector: selector,
inner_text: inner_text
)
super message
end
end
class DriverInstallationError < Error
def initialize(error : Exception)
message = <<-ERROR
Something went wrong while installing the web driver
If you'd like to manually install the web driver yourself, make sure to tell LuckyFlow where it is located:
LuckyFlow.configure do |settings|
settings.driver_path = "/path/to/webdriver"
end
ERROR
super message, cause: error
end
end
class InvalidOperationError < Error
end
class InvalidMultiSelectError < InvalidOperationError
def initialize
super "Unable to select multiple options when select element does not have 'multiple' attribute"
end
end
class InfiniteRedirectError < Error
end
end