这是indexloc提供的服务,不要输入任何密码
Skip to content

Improve error messages for metadata apply errors #1877

@danielcompton

Description

@danielcompton

While testing out #1863, I noticed that the error messages for invalid metadata could be more helpful. Currently, the errors show as:

FATA[0002] cannot apply metadata on the database: [constraint-error] 
  no foreign constraint exists on the given column 
  ($.args[1].args.tables[7].object_relationships[0])

that corresponds to this object:

tables:
# ...
- array_relationships: []
  delete_permissions: []
  event_triggers: []
  insert_permissions: []
  object_relationships:
  - comment: null
    name: authGroupBygroupId
    using:
      foreign_key_constraint_on: group_id
  - comment: null
    name: authUserByuserId
    using:
      foreign_key_constraint_on: user_id
  select_permissions: []
  table: auth_user_groups
  update_permissions: []

It could be nice to use the names in the error message, as well as the indexes. For example:

FATA[0002] cannot apply metadata on the database: [constraint-error] 
  no foreign constraint exists on the given column 
  ($.args[1].args.tables[7].object_relationships[0]) 
  (table: auth_user_groups, object_relationship: authGroupBygroupId, foreign_key_constraint: group_id)

In general, Hasura has excellent error messages which I appreciate.

Metadata

Metadata

Assignees

Labels

c/cliRelated to CLIe/intermediatecan be wrapped up in a weekp/mediumnon-urgent issues/features that are candidates for being included in one of the upcoming sprints

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions