class GraphQL::UnauthorizedError
When an authorized? hook returns false, this error is used to communicate the failure. It’s passed to Schema.unauthorized_object.
Alternatively, custom code in authorized? may raise this error. It will be routed the same way.
Attributes
Returns
-
GraphQL::Query::Context— the context for the current query
Returns
-
Object— the application object that failed the authorization check
Public Class Methods
# File lib/graphql/unauthorized_error.rb, line 24 def initialize(message = nil, object: nil, type: nil, context: nil) if message.nil? && object.nil? && type.nil? raise ArgumentError, "#{self.class.name} requires either a message or keywords" end @path = nil @object = object @type = type @context = context @ast_nodes = nil message ||= "An instance of #{object.class} failed #{type.graphql_name}'s authorization check" super(message) end
Calls superclass method
Public Instance Methods
# File lib/graphql/unauthorized_error.rb, line 40 def finalize_graphql_result(query, result_data, key) result_data[key] = nil end