Sha256: 44f931b3413a82ad2f12a43e4cdd0b8585fa8e5d3f9b5de08412b0c41fe226db
Contents?: true
Size: 831 Bytes
Versions: 13
Compression:
Stored size: 831 Bytes
Contents
# frozen_string_literal: true module GraphQL class UnauthorizedError < GraphQL::Error # @return [Object] the application object that failed the authorization check attr_reader :object # @return [Class] the GraphQL object type whose `.authorized?` method was called (and returned false) attr_reader :type # @return [GraphQL::Query::Context] the context for the current query attr_reader :context def initialize(message = nil, object: nil, type: nil, context: nil) if message.nil? && object.nil? raise ArgumentError, "#{self.class.name} requires either a message or keywords" end @object = object @type = type @context = context message ||= "An instance of #{object.class} failed #{type.name}'s authorization check" super(message) end end end
Version data entries
13 entries across 13 versions & 1 rubygems