mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
Prevent crash for backup plugin if there is no internet connection
This commit is contained in:
parent
3e819f56fc
commit
222f8e6cdb
1 changed files with 7 additions and 4 deletions
|
@ -40,10 +40,13 @@ class DriveApiService:
|
|||
if not access_token:
|
||||
Logger.log("w", "Could not get access token.")
|
||||
return []
|
||||
|
||||
backup_list_request = requests.get(self.BACKUP_URL, headers = {
|
||||
"Authorization": "Bearer {}".format(access_token)
|
||||
})
|
||||
try:
|
||||
backup_list_request = requests.get(self.BACKUP_URL, headers = {
|
||||
"Authorization": "Bearer {}".format(access_token)
|
||||
})
|
||||
except requests.exceptions.ConnectionError:
|
||||
Logger.log("w", "Unable to connect with the server.")
|
||||
return []
|
||||
|
||||
# HTTP status 300s mean redirection. 400s and 500s are errors.
|
||||
# Technically 300s are not errors, but the use case here relies on "requests" to handle redirects automatically.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue