Added connection status functionalities; ping and error

The connection can now be pinged before each call, to test the status of
the connection. If there is an error, it is caught and returned in a
user friendly way.