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

Error: "Could not infer helper mode for keyword" isn't helpful #493

Open
dylanplural opened this issue Oct 4, 2022 · 4 comments
Open

Error: "Could not infer helper mode for keyword" isn't helpful #493

dylanplural opened this issue Oct 4, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@dylanplural
Copy link

I'm doing some fairly complicated query building with lots of nesting and I hit this error.

It's almost impossible to debug as it doesn't log out any useful information about which parameter triggered the error message.

I believe this error should include some more helpful information such as:

  • The type of the keyword
  • The value of the keyword
  • The position of the keyword within the query
@ChristophP
Copy link
Contributor

I've had similar issues. Whenever I try to build a query and ends up being invalid, all I get is the Postgres error saying "invalid syntax near SELECT" or so which is often not enough to point to the error directly.

It would be useful to get the full string that was sent to the DB also in the error case.
I can get it with .describe() but when the query is invalid that doesn't work.

@porsager
Copy link
Owner

@dylanplural I've got a POC to improve these things that I'm toying around with, but time is unfortunately quite limited for me currently :-(

@ChristophP
On the error object you have non enumerable properties query and parameters.
Setting debug: true will make query and parameters enumerable so they will show up when logging the errors. That should help you ;)

@ChristophP
Copy link
Contributor

Great, that does help me. Thank you :-)

@ChristophP
Copy link
Contributor

ChristophP commented Oct 13, 2022

Oh it's event right there in the docs. https://github.com/porsager/postgres#error-handling How could I miss that 🤦 ? Anyway, thanks

@porsager porsager added the enhancement New feature or request label Jun 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants