Sha256: eac73cef3501aa48c6c09e2fc37cf24c5e3d5fa8358ebf7f72564377e14c7738

Contents?: true

Size: 666 Bytes

Versions: 3

Compression:

Stored size: 666 Bytes

Contents

module Stove
  module Error
    class StoveError < StandardError
      def initialize(options = {})
        return super(options[:_message]) if options[:_message]

        class_name = self.class.to_s.split('::').last
        error_key  = Util.underscore(class_name)

        super I18n.t("stove.errors.#{error_key}", options)
      end
    end

    class ValidationFailed < StoveError
      def initialize(klass, id, options = {})
        super _message: I18n.t("stove.validations.#{klass}.#{id}", options)
      end
    end

    class GitFailed < StoveError; end
    class MetadataNotFound < StoveError; end
    class ServerUnavailable < StoveError; end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
stove-2.0.0 lib/stove/error.rb
stove-2.0.0.beta.2 lib/stove/error.rb
stove-2.0.0.beta.1 lib/stove/error.rb