Sha256: 1848802f322ddf2f040cfd9e8ced75f0cb291bd6874e27b8e4b762e3e666a668

Contents?: true

Size: 742 Bytes

Versions: 11

Compression:

Stored size: 742 Bytes

Contents

module SmartIoC::Errors
  class BeanNotFound < StandardError
    def initialize(bean_name)
      super("Unable to find bean :#{bean_name} in any packages")
    end
  end

  class AmbiguousBeanDefinition < StandardError
    attr_accessor :parent_bean_definition

    def initialize(bean_name, bean_definitions)
      @bean_name = bean_name
      @bean_definitions = bean_definitions
    end

    def message
      <<~EOS
        Unable to inject bean :#{@bean_name}#{@parent_bean_definition ? " into :#{@parent_bean_definition.name} (package: #{@parent_bean_definition.package})" : ""}.
        Several bean definitions with name :#{@bean_name} were found:

        #{@bean_definitions.map(&:inspect).join("\n\n")}
      EOS
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
smart_ioc-0.5.2 lib/smart_ioc/errors.rb
smart_ioc-0.5.1 lib/smart_ioc/errors.rb
smart_ioc-0.5.0 lib/smart_ioc/errors.rb
smart_ioc-0.3.9 lib/smart_ioc/errors.rb
smart_ioc-0.4.0 lib/smart_ioc/errors.rb
smart_ioc-0.3.8 lib/smart_ioc/errors.rb
smart_ioc-0.3.7 lib/smart_ioc/errors.rb
smart_ioc-0.3.6 lib/smart_ioc/errors.rb
smart_ioc-0.3.5 lib/smart_ioc/errors.rb
smart_ioc-0.3.2 lib/smart_ioc/errors.rb
smart_ioc-0.3.1 lib/smart_ioc/errors.rb