lib/fluxo/errors.rb in fluxo-0.2.1 vs lib/fluxo/errors.rb in fluxo-0.3.0

- old
+ new

@@ -1,18 +1,21 @@ module Fluxo - class Error < StandardError - end + module Errors + # @param result [Fluxo::Result] The result to be checked + def self.raise_operation_error!(result) + raise result if result.is_a?(Exception) + raise result.value if result.operation.class.strict? - class InvalidResultError < Error + [SyntaxError, ArgumentError, NoMethodError, Fluxo::Error].each do |exception| + raise result.value if result.value.is_a?(exception) + end + end end - class AttributeError < Error + class Error < StandardError end - class NotDefinedAttributeError < AttributeError - end - - class MissingAttributeError < AttributeError + class InvalidResultError < Error end class ValidationDefinitionError < Error end end