refactor error handling when creating user/company