lib/ballast/errors.rb in ballast-1.9.3 vs lib/ballast/errors.rb in ballast-2.0.0

- old
+ new

@@ -6,29 +6,32 @@ module Ballast # Common errors raised by a Rails application. module Errors # The base error raised from an application. # - # @attribute [r] response - # @return [String|Hash] The response which contains either a message or an hash with status code and a error message. - class BaseError < RuntimeError - attr_reader :response + # @attribute [r] details + # @return [String|Hash|NilClass] The details of the error. If a Hash, it should contain the keys `status` and `error`. + class Base < RuntimeError + attr_reader :details - def initialize(msg = nil) - super(msg) - @response = msg + # Creates a new error. + # + # @param details [String|Hash|NilClass] The details of this error. + def initialize(details = nil) + super("") + @details = details end end # This is raised when an invalid domain is requested. - class InvalidDomain < BaseError + class InvalidDomain < Base end - # This is raised when something went wrong during the processing of a operation. - class PerformError < BaseError + # This is raised when something went wrong during the processing of a operation or a service. + class Failure < Base end - # This is raised when some invalid parameters are passed to a operation. - class ValidationError < BaseError + # This is raised when some invalid parameters are passed to a operation or a service. + class ValidationFailure < Failure end end -end \ No newline at end of file +end