Sha256: e1dd4d81b47269b030c50617e602268856a0536b141cb63f9e09584b7418d41b

Contents?: true

Size: 1.11 KB

Versions: 13

Compression:

Stored size: 1.11 KB

Contents

# Refinements
# =======================================================================

require 'nrser/refinements'
using NRSER


# 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

13 entries across 13 versions & 1 rubygems

Version Path
qb-0.3.25 lib/qb/role/errors.rb
qb-0.3.24 lib/qb/role/errors.rb
qb-0.3.23 lib/qb/role/errors.rb
qb-0.3.22 lib/qb/role/errors.rb
qb-0.3.21 lib/qb/role/errors.rb
qb-0.3.20 lib/qb/role/errors.rb
qb-0.3.19 lib/qb/role/errors.rb
qb-0.3.18 lib/qb/role/errors.rb
qb-0.3.17 lib/qb/role/errors.rb
qb-0.3.16 lib/qb/role/errors.rb
qb-0.3.15 lib/qb/role/errors.rb
qb-0.3.14 lib/qb/role/errors.rb
qb-0.3.13 lib/qb/role/errors.rb