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

Include hint in query error #548

Merged
merged 2 commits into from
Nov 26, 2024
Merged

Include hint in query error #548

merged 2 commits into from
Nov 26, 2024

Conversation

dwwoelfel
Copy link
Contributor

We get a lot of people in the discord who are confused about query errors because all they see is "Validation failed for query" in the error message. This passes along the hint so that they can identify the problem.

Before

{
    "message": "Validation failed for query"
}

After

{
    "message": "Validation failed for query",
    "hint": {
        "data-type": "query",
        "input": {
            "comments": {
                "$": {
                    "where": {
                        "someField": {
                            "$gt": 50
                        }
                    }
                }
            }
        },
        "errors": [
            {
                "expected?": "indexed?",
                "in": [
                    "comments",
                    "$",
                    "where",
                    "someField"
                ],
                "message": "The `comments.someField` attribute must be indexed to use comparison operators."
            }
        ]
    }
}

Copy link

View Vercel preview at instant-www-js-add-hint-jsv.vercel.app.

@nezaj nezaj assigned nezaj and unassigned nezaj Nov 26, 2024
@nezaj nezaj self-requested a review November 26, 2024 17:22
Copy link
Contributor

@nezaj nezaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! (I think some of the docs got included with this PR)

Copy link
Contributor

@stopachka stopachka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@dwwoelfel
Copy link
Contributor Author

dwwoelfel commented Nov 26, 2024

(I think some of the docs got included with this PR)

Thanks for catching! Fixed!

@dwwoelfel dwwoelfel merged commit fab247b into main Nov 26, 2024
26 checks passed
@dwwoelfel dwwoelfel deleted the add-hint branch November 26, 2024 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants