small refactoring to showing error messages when server not reachable