Added additional error handling to the client module.