Handle more error conditions from Google
from aiohttp import ClientSession, ContentTypeError, ClientConnectorError, ClientTimeout
-from aiohttp.client_exceptions import ServerTimeoutError
-from backup.exceptions import GoogleInternalError, GoogleRateLimitError, GoogleCredentialsExpired, CredRefreshGoogleError, DriveQuotaExceeded, GoogleDrivePermissionDenied, GoogleDnsFailure, GoogleCantConnect, GoogleTimeoutError
+from aiohttp.client_exceptions import ServerTimeoutError, ServerDisconnectedError, ClientOSError
+from backup.exceptions import GoogleUnexpectedError, GoogleInternalError, GoogleRateLimitError, GoogleCredentialsExpired, CredRefreshGoogleError, DriveQuotaExceeded, GoogleDrivePermissionDenied, GoogleDnsFailure, GoogleCantConnect, GoogleTimeoutError
from backup.util import Resolver
from backup.logger import getLogger
from backup.config import Config, Setting
@@ -57,8 +57,14 @@ class DriveRequester():
# Wish there was a better way to identify this exception
raise GoogleDnsFailure()
raise
+ except ClientOSError as e:
+ if e.errno == 1:
+ raise GoogleUnexpectedError()
+ raise
except ServerTimeoutError:
raise GoogleTimeoutError()
+ except ServerDisconnectedError:
+ raise GoogleUnexpectedError()
except DNSException:
logger.debug(
"Ran into trouble resolving Google Drive's servers. We'll use normal DNS servers on the next attempt.")
