Emit connect event with error (if connecting) or emit errorMessage event...

... on socket error

When a network issue prevents connection to the database, there is no
callback made to the connection callback nor to the errorMessage
callback. Only the connection.end event is fired. This leads to silent
failures.