Sha256: 5f6740c35c954afc47efe7c3c0b9803bcfa06b4c2eb7eba40dc6897d87b8b353

Contents?: true

Size: 634 Bytes

Versions: 5

Compression:

Stored size: 634 Bytes

Contents

require 'i18n'

module Scorpion
  class Error < StandardError

    private
      def translate( key, args = {} )
        I18n.translate key, args.merge( scope: [:scorpion,:errors,:messages] )
      end
  end

  class UnsuccessfulHunt < Error
    attr_reader :contract
    attr_reader :traits

    def initialize( contract, traits = nil )
      @contract = contract
      @traits   = traits

      super translate( :unsuccessful_hunt, contract: contract, traits: traits )
    end
  end

  class BuilderRequiredError < Error
    def initialize( message = nil )
      super ( message || translate( :builder_required ) )
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
scorpion-ioc-0.4.0 lib/scorpion/error.rb
scorpion-ioc-0.3.1 lib/scorpion/error.rb
scorpion-ioc-0.3.0 lib/scorpion/error.rb
scorpion-ioc-0.2.0 lib/scorpion/error.rb
scorpion-ioc-0.1.0 lib/scorpion/error.rb