graphql_rails icon indicating copy to clipboard operation
graphql_rails copied to clipboard

Show trace to attribute defininion in case of wrong type

Open povilasjurcys opened this issue 3 years ago • 0 comments

In case of wrong time we usually receive message such as:

/home/povilas/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/graphql_rails-2.1.0/lib/graphql_rails/attributes/type_parseable.rb:164:in `raise_not_supported_type_error': Type "[Types::SomeTypeWithTypo!]!" is not supported. Supported scalar types are: ["id", "int", "integer", "big_int", "bigint", "float", "double", "decimal", "bool", "boolean", "string", "str", "text", "date", "time", "datetime", "date_time", "json"]. All the classes that includes `GraphqlRails::Model` are also supported as types. (GraphqlRails::Attributes::TypeParseable::UnknownTypeError)
	from /home/povilas/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/graphql_rails-2.1.0/lib/graphql_rails/attributes/input_type_parser.rb:35:in `unwrapped_type'

Sadly, backtrace does not include line where this definition was made so I need to search in the whole project to find that type. It would be nice to see something like this:

/home/povilas/path/to/my/graphql_rails/model.rb:15 `raise_not_supported_type_error': Type "[Types::SomeTypeWithTypo!]!" is not supported. Supported scalar types are: ["id", "int", "integer", "big_int", "bigint", "float", "double", "decimal", "bool", "boolean", "string", "str", "text", "date", "time", "datetime", "date_time", "json"]. All the classes that includes `GraphqlRails::Model` are also supported as types. (GraphqlRails::Attributes::TypeParseable::UnknownTypeError)

povilasjurcys avatar Jan 24 '22 04:01 povilasjurcys