Use logger for errors instead of printing them to stdout

This way they will show up in users' logs.
This commit is contained in:
Ghostkeeper 2019-09-12 15:25:01 +02:00
parent a6a106b526
commit 2d2bf9e279
No known key found for this signature in database
GPG key ID: 86BEF881AE2CF276

View file

@ -1,10 +1,11 @@
# Copyright (c) 2019 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from typing import Dict, List, Optional
from typing import Dict, List, Optional
from PyQt5.QtCore import QTimer
from UM import i18nCatalog
from UM.Logger import Logger # To log errors talking to the API.
from UM.Signal import Signal
from cura.API import Account
from cura.CuraApplication import CuraApplication
@ -37,7 +38,7 @@ class CloudOutputDeviceManager:
# Persistent dict containing the remote clusters for the authenticated user.
self._remote_clusters = {} # type: Dict[str, CloudOutputDevice]
self._account = CuraApplication.getInstance().getCuraAPI().account # type: Account
self._api = CloudApiClient(self._account, on_error=lambda error: print(error))
self._api = CloudApiClient(self._account, on_error = lambda error: Logger.log("e", error))
self._account.loginStateChanged.connect(self._onLoginStateChanged)
# Create a timer to update the remote cluster list