Skip to content

Proposal: Better error message when "holding it wrong" for mapping up actions #315

Open
@olivermt

Description

@olivermt

If you accidentally do create :foo, :some_generic_action in the graphql block, you get this rather cryptic error:

== Compilation error in file lib/safari_web/graphql_schema.ex ==
** (KeyError) key :error_location not found in: %AshGraphql.Resource.Mutation{
  name: :supplemental_document_create,
  action: %Ash.Resource.Actions.Action{
    name: :create_graphql,
    description: nil,
    returns: Safari.Types.SafariFileUploadInfo,
    run: {Ash.Resource.Action.ImplementationFunction,
     [
       fun: &Safari.Outcrop.SupplementalDocument.run_0_generated_174EE05532EAC7ACD9CA74CC91968491/2
     ]},
    constraints: [
      fields: [
        token: [allow_nil?: false, constraints: [], type: Ash.Type.String],
        path: [allow_nil?: false, constraints: [], type: Ash.Type.String]
      ]
    ],
    touches_resources: [],
    skip_unknown_inputs: [],
    arguments: [
      %Ash.Resource.Actions.Argument{
        allow_nil?: false,
        type: Safari.Types.SupplementalDocumentnitialInput,
        name: :note,
        default: nil,
        sensitive?: false,
        description: nil,
        public?: true,
        constraints: [
          fields: [
            note: [allow_nil?: true, constraints: [], type: Ash.Type.String],
            outcrop_id: [
              allow_nil?: true,
              constraints: [],
              type: Ash.Type.Integer
            ],
            study_id: [
              allow_nil?: true,
              constraints: [],
              type: Ash.Type.Integer
            ]
          ]
        ]
      }
    ],
    allow_nil?: false,
    transaction?: false,
    primary?: false,
    type: :action
  },
  type: :create,
  identity: nil,
  read_action: nil,
  resource: nil,
  upsert?: false,
  upsert_identity: false,
  modify_resolution: nil,
  relay_id_translations: [],
  description: nil,
  hide_inputs: []
}
    (ash_graphql 1.7.6) lib/resource/resource.ex:1123: anonymous fn/5 in AshGraphql.Resource.mutation_types/4
    (elixir 1.17.2) lib/enum.ex:4353: Enum.flat_map_list/2
    (ash_graphql 1.7.6) lib/domain/domain.ex:293: anonymous fn/5 in AshGraphql.Domain.type_definitions/8
    (elixir 1.17.2) lib/enum.ex:4353: Enum.flat_map_list/2
    (elixir 1.17.2) lib/enum.ex:4354: Enum.flat_map_list/2
    (ash_graphql 1.7.6) lib/domain/domain.ex:284: AshGraphql.Domain.type_definitions/8
    deps/ash_graphql/lib/ash_graphql.ex:334: Safari.Outcrop.AshTypes.run/2
    (absinthe 1.7.9) lib/absinthe/pipeline.ex:408: Absinthe.Pipeline.run_phase/3

I do think there is more than enough introspection available to make this error message better in this error path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Someday

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions