lib/ballast/service.rb in ballast-2.1.3 vs lib/ballast/service.rb in ballast-2.2.0
- old
+ new
@@ -96,15 +96,21 @@
end
# Marks the failure of the operation.
#
# @param details [Object] The error(s) occurred.
- # @param on_validation [Boolean] Whether the error(s) was/were validation error(s).
def self.fail!(details, on_validation: false)
- raise(on_validation ? Errors::ValidationFailure : Errors::Failure, details)
+ raise(Errors::Failure, details)
end
+ # Marks the failure of the validation of the operation.
+ #
+ # @param details [Object] The error(s) occurred.
+ def self.fail_validation!(details)
+ raise(Errors::ValidationFailure, details)
+ end
+
# Creates a service object.
#
# @param owner [Object|NilClass] The owner of the service.
def initialize(owner = nil)
@owner = owner
@@ -129,12 +135,18 @@
end
# Marks the failure of the operation.
#
# @param details [Object] The error(s) occurred.
- # @param on_validation [Boolean] Whether the error(s) was/were validation error(s).
- def fail!(details, on_validation: false)
- self.class.fail!(details, on_validation: on_validation)
+ def fail!(details)
+ raise(Errors::Failure, details)
+ end
+
+ # Marks the failure of the validation of the operation.
+ #
+ # @param details [Object] The error(s) occurred.
+ def fail_validation!(details)
+ raise(Errors::ValidationFailure, details)
end
# Handles a failure.
#
# @param failure [Failure] The failure to handle.