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

Bad error messages with singleRow #72

Open
agrafix opened this issue Mar 26, 2017 · 8 comments
Open

Bad error messages with singleRow #72

agrafix opened this issue Mar 26, 2017 · 8 comments

Comments

@agrafix
Copy link
Contributor

agrafix commented Mar 26, 2017

If a query does not return anything (i.E. a plain INSERT), and I use the D.singleRow decoder, I get the following error:

SessionError (ResultError (UnexpectedResult "Unexpected result status: CommandOk"))

That's not helpful :-( Is there any way to improve this? I think we would only need to change

checkExecStatus :: (LibPQ.ExecStatus -> Bool) -> Result ()

so that one can provide a custom error message there and use that in the single function?

@nikita-volkov
Copy link
Owner

What kind of error message would you expect in such case?

@agrafix
Copy link
Contributor Author

agrafix commented Mar 27, 2017

Something along the lines: Expected one row, but got an empty result?

@dispanser
Copy link

Just hit the same issue, but luckily a web search brought me here. Couldn't wrap my head around the fact that CommandOk could be a bad thing :)

@nikita-volkov
Copy link
Owner

PR welcome :)

@gfarrell
Copy link

Also hit the same issue, but using hasql-th -- I had a vectorStatement for a query which had no result, but thought hasql-th would have caught that there is no output of the query. Also didn't understand what was going wrong until I arrived at this issue.

I don't really feel confident that I'd be able to contribute to hasql as a bit of a baby Haskeller, but with some pointers I could try.

@mitchellwrosen
Copy link
Contributor

@gfarrell Would you like to pair over a discord call or something? I'm also interested in improving this error message

@gfarrell
Copy link

@mitchellwrosen for a few reasons I'm probably abandoning Hasql in favour of Persistent so I probably won't be working on this, sorry!

@mitchellwrosen
Copy link
Contributor

Hehe, no worries! (But also, you should use hasql ;))

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

No branches or pull requests

5 participants