Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error message for resource.get that isn't unique #474

Open
benjie opened this issue Aug 11, 2023 · 0 comments
Open

Improve error message for resource.get that isn't unique #474

benjie opened this issue Aug 11, 2023 · 0 comments
Labels
💅 enhancement New feature or request good first issue Good for newcomers
Milestone

Comments

@benjie
Copy link
Member

benjie commented Aug 11, 2023

   "message": "An error occurred (logged with hash: 'Attempted to call PgResource(dependency).get({id}) at child field (TODO: which one?) but that combination of attributes is not unique (uniques: [{\"isPrimary\":true,\"attributes\":[\"block_id\",\"dependency_id\"],\"extensions\":{\"tags\":{}}}]). Did you mean to call .find() instead?\n\nGraphQL HTTP Request:5:5\n4 |     success\n5 |     dependency {\n  |     ^\n6 |       id')",

Reported by @sgrove

Context: https://discord.com/channels/489127045289476126/498852330754801666/1139357431210704947

This error would be more helpful if it found the primary unique and then told you to do that instead, e.g.:

Attempted to call PgResource(dependency).get({id: ...}) at child field (TODO: which one?) but {PROBLEM}. Valid calls would look like {one of}: `.get({ block_id: ... })`, `.get({ organization_id: ..., number: ... })`, or if you want more than one record use `.find()` instead.

Where {PROBLEM} is something like:

- `id` is not a column of `{RESOURCE_NAME}`
- {these keys|this key} (`id`) does not uniquely identify a record
@benjie benjie added 💅 enhancement New feature or request good first issue Good for newcomers labels Aug 11, 2023
@benjie benjie added this to the V5 RC milestone Aug 11, 2023
@benjie benjie added this to V5.0.0 Oct 4, 2023
@github-project-automation github-project-automation bot moved this to 🌳 Triage in V5.0.0 Oct 4, 2023
@benjie benjie moved this from 🌳 Triage to 🐭 Shrew in V5.0.0 Oct 4, 2023
@benjie benjie removed this from V5.0.0 Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💅 enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant