Adds error handling to client