Skip to content

Generated CreateForm: Catch statement throws an error itself (Handle graphql errors properly) #1168

@bryan-ds

Description

@bryan-ds

Problem:

onSubmit handler has a catch block:

} catch (err) { if (onError) { const messages = err.errors.map((e) => e.message).join("\n"); onError(modelFields, messages); } }

err does not necessarily have an errors attribute, which will result in an error thrown: TypeError: Cannot read properties of undefined (reading 'map').

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions