Sha256: eeea0ee2a61bd0e9d876f2ee4109b52dfcca5e87471aef375084d105dfc6167d

Contents?: true

Size: 594 Bytes

Versions: 1

Compression:

Stored size: 594 Bytes

Contents

module Miau
  class Error < StandardError; end

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

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

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

      super(message)
    end
  end

  class NotDefinedError < Error
  end

  class AuthorizationNotPerformedError < Error
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
miau-0.1.0 lib/miau/error.rb