Check for error responses and call the handler

When we get a response on the socket, parse the error response and call the
handler if one has been set.