benbjohnson / postlite

Postgres wire compatible SQLite proxy.
Apache License 2.0
1.21k stars 30 forks source link

Unexpected message type #2

Open coder543 opened 2 years ago

coder543 commented 2 years ago

super minor issue, but it looks like postlite will simply log an error when it receives an unexpected message type. I saw elsewhere in the code that you already have a pattern for sending errors to the client, so maybe this would be a good candidate for something worth sending errors to the client about? Otherwise, ~I'm pretty sure the connection will get into an inconsistent state where the client is stuck waiting for a response, and~ the end user will likely be very confused.

(edit: I see that the connection will be terminated, which at least helps a bit)

https://github.com/benbjohnson/postlite/blob/main/server.go#L239

benbjohnson commented 2 years ago

Thanks for the bug report. Yeah, the error handling could be better. I've been overly prudent so far by just killing the connection and logging the error but I'll get that fixed it. 👍