class GraphQL::UnauthorizedFieldError
Attributes
field[RW]
@return [Field] the field that failed the authorization check
Public Class Methods
new(message = nil, object: nil, type: nil, context: nil, field: nil)
click to toggle source
Calls superclass method
GraphQL::UnauthorizedError::new
# File lib/graphql/unauthorized_field_error.rb, line 7 def initialize(message = nil, object: nil, type: nil, context: nil, field: nil) if message.nil? && [field, type].any?(&:nil?) raise ArgumentError, "#{self.class.name} requires either a message or keywords" end @field = field message ||= begin if object "An instance of #{object.class} failed #{type.name}'s authorization check on field #{field.name}" else "Failed #{type.name}'s authorization check on field #{field.name}" end end super(message, object: object, type: type, context: context) end