refactor the interpretation of SSL errors into a function