Exception: GraphQL::UnauthorizedError

Inherits:
Error
  • Object
show all
Defined in:
lib/graphql/unauthorized_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object:, type:, context:) ⇒ UnauthorizedError

Returns a new instance of UnauthorizedError.



13
14
15
16
17
18
# File 'lib/graphql/unauthorized_error.rb', line 13

def initialize(object:, type:, context:)
  @object = object
  @type = type
  @context = context
  super("An instance of #{object.class} failed #{type.name}'s authorization check")
end

Instance Attribute Details

#contextGraphQL::Query::Context (readonly)

Returns the context for the current query.

Returns:



11
12
13
# File 'lib/graphql/unauthorized_error.rb', line 11

def context
  @context
end

#objectObject (readonly)

Returns the application object that failed the authorization check.

Returns:

  • (Object)

    the application object that failed the authorization check



5
6
7
# File 'lib/graphql/unauthorized_error.rb', line 5

def object
  @object
end

#typeClass (readonly)

Returns the GraphQL object type whose .authorized? method was called (and returned false).

Returns:

  • (Class)

    the GraphQL object type whose .authorized? method was called (and returned false)



8
9
10
# File 'lib/graphql/unauthorized_error.rb', line 8

def type
  @type
end