2
2
3
3
module Dry
4
4
class Operation
5
+ class Error < ::StandardError ; end
6
+
5
7
# Methods to prepend have already been defined
6
- class MethodsToPrependAlreadyDefinedError < :: StandardError
8
+ class MethodsToPrependAlreadyDefinedError < Error
7
9
def initialize ( methods :)
8
10
super <<~MSG
9
11
'.operate_on' must be called before the given methods are defined.
@@ -13,7 +15,7 @@ def initialize(methods:)
13
15
end
14
16
15
17
# Configuring prepending after a method has already been prepended
16
- class PrependConfigurationError < :: StandardError
18
+ class PrependConfigurationError < Error
17
19
def initialize ( methods :)
18
20
super <<~MSG
19
21
'.operate_on' and '.skip_prepending' can't be called after any methods\
@@ -24,7 +26,7 @@ def initialize(methods:)
24
26
end
25
27
26
28
# Missing dependency required by an extension
27
- class MissingDependencyError < :: StandardError
29
+ class MissingDependencyError < Error
28
30
def initialize ( gem :, extension :)
29
31
super <<~MSG
30
32
To use the #{ extension } extension, you first need to install the \
@@ -33,6 +35,15 @@ def initialize(gem:, extension:)
33
35
end
34
36
end
35
37
38
+ class InvalidStepResultError < Error
39
+ def initialize ( result :)
40
+ super <<~MSG
41
+ Your step must return `Success(..)` or `Failure(..)`, \
42
+ from `Dry::Monads::Result`. Instead, it was `#{ result . inspect } `.
43
+ MSG
44
+ end
45
+ end
46
+
36
47
# An error related to an extension
37
48
class ExtensionError < ::StandardError ; end
38
49
end
0 commit comments