Exception: Synthra::Errors::UnknownTypeError

Inherits:
ParseError show all
Defined in:
lib/synthra/errors.rb

Overview

Unknown type referenced in DSL

Raised when a field uses a type that hasn't been registered. This could be a typo or a custom type that wasn't defined. Includes "did you mean" suggestions for similar type names.

Examples:

# User:
#   name: strng  <- UnknownTypeError: Unknown type 'strng'. Did you mean: string, text?

Constant Summary collapse

ERROR_CODE =
"UNKNOWN_TYPE_ERROR"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type_name, suggestions: nil, **kwargs) ⇒ UnknownTypeError

Create a new UnknownTypeError

Parameters:

  • type_name (String)

    the type name that wasn't found

  • suggestions (Array<String>) (defaults to: nil)

    similar type names

  • kwargs (Hash)

    location information (line, column, source_line)



264
265
266
267
# File 'lib/synthra/errors.rb', line 264

def initialize(type_name, suggestions: nil, **kwargs)
  @type_name = type_name
  super("Unknown type '#{type_name}'", suggestions: suggestions, **kwargs)
end

Instance Attribute Details

#type_nameString (readonly)

Returns the unknown type name that was referenced.

Returns:

  • (String)

    the unknown type name that was referenced



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/synthra/errors.rb', line 252

class UnknownTypeError < ParseError
  ERROR_CODE = "UNKNOWN_TYPE_ERROR"
  attr_reader :type_name


  # Create a new UnknownTypeError
  #
  # @param type_name [String] the type name that wasn't found
  # @param suggestions [Array<String>] similar type names
  # @param kwargs [Hash] location information (line, column, source_line)
  #

  def initialize(type_name, suggestions: nil, **kwargs)
    @type_name = type_name
    super("Unknown type '#{type_name}'", suggestions: suggestions, **kwargs)
  end
end