Add error handler for client

Otherwise it throws unhandled errors.