Method: GraphQL::UnauthorizedFieldError#initialize
- Defined in:
- lib/graphql/unauthorized_field_error.rb
#initialize(message = nil, object: nil, type: nil, context: nil, field: nil) ⇒ UnauthorizedFieldError
Returns a new instance of UnauthorizedFieldError.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/graphql/unauthorized_field_error.rb', line 7 def initialize( = nil, object: nil, type: nil, context: nil, field: nil) if .nil? && [field, type].any?(&:nil?) raise ArgumentError, "#{self.class.name} requires either a message or keywords" end @field = field ||= 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(, object: object, type: type, context: context) end |