Sha256: edcab88c4a1e2f70ef52bd7e2e43369240eb3f84002b8213d6e54608a2237dab

Contents?: true

Size: 1005 Bytes

Versions: 6

Compression:

Stored size: 1005 Bytes

Contents

# Definitions
# =======================================================================

module QB
  class Role
    # raised by `.require` when no roles match input
    class NoMatchesError < QB::UserInputError
      attr_accessor :input
      
      def initialize input
        @input = input
        
        super "no roles match input #{ @input.inspect }"
      end
    end
    
    # raised by `.require` when multiple roles match
    class MultipleMatchesError < QB::UserInputError
      attr_accessor :input, :matches
      
      def initialize input, matches
        @input = input
        @matches = matches
        
        super binding.erb <<-END
          multiple roles match input <%= @input.inspect %>:
          
          <% @matches.map do |role| %>
            -   <%= role.to_s %> (<%= role.path.to_s %>)
          <% end %>
          
        END
      end
    end
    
    # raised when there's bad metadata
    class MetadataError < QB::StateError
    end
  end # Role
end # QB

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
qb-0.4.5 lib/qb/role/errors.rb
qb-0.4.4 lib/qb/role/errors.rb
qb-0.4.3 lib/qb/role/errors.rb
qb-0.4.2 lib/qb/role/errors.rb
qb-0.4.1 lib/qb/role/errors.rb
qb-0.4.0 lib/qb/role/errors.rb