wvanbergen/vertigo — pull request #4 by wvanbergen (2013-10-08 09:49:13+00:00)
Title: Error handling improvements

Improved error handling. Make a distinction between expected and unexpected errors.

- Expected errors (e.g. SQL syntax error) are handled as error values, and will be returned as such by the library. The conform to the `ErrorResponse` interface. After an error like this, the connection can be used again for querying,
- Expected errors while calling `Connect` are returned as the error return value. After they occur, the socket will be closed and the connection will not be in a usable state.
- Unexpected network/IO errors: The protocol is stateful, and after a network error the state of the protocol is non-deterministic. Because of this, they will be panicked, and are recovered by the connection object and return as an error return value that do not conform to the `ErrorResponse` interface. After they occur, the socket is closed and the connection is reset, but the connection will automatically reconnect if it is used again.

I also added some initial godoc comments.