Emit error when getting an error from the server.