Sha256: 9bcb3b9ed3db4c9c9aabf3e3eb595c6b42cdd7d58d9d83bcffd3991aa421e22a

Contents?: true

Size: 682 Bytes

Versions: 5

Compression:

Stored size: 682 Bytes

Contents

module Banken
  class Error < StandardError; end

  class NotAuthorizedError < Error
    attr_reader :controller, :query, :loyalty

    def initialize(options={})
      if options.is_a? String
        message = options
      else
        @controller = options[:controller]
        @query      = options[:query]
        @loyalty    = options[:loyalty]

        message = options.fetch(:message) { "not allowed to #{query} of #{controller} by #{loyalty.inspect}" }
      end

      super(message)
    end
  end

  class NotDefinedError < Error; end
  class AuthorizationNotPerformedError < Error; end

  class LoyaltyScopingNotPerformedError < AuthorizationNotPerformedError; end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
banken-1.0.3 lib/banken/error.rb
banken-1.0.2 lib/banken/error.rb
banken-1.0.1 lib/banken/error.rb
banken-1.0.0 lib/banken/error.rb
banken-0.1.1 lib/banken/error.rb