🎨 Work on import error handling

- Generic ErrorProducer class
- Importer and managers are error producers
- SGDB Auth friendly error
- Bad source location friendly errors (data, config, cache)
- Removed unused decorators
This commit is contained in:
GeoffreyCoulaud
2023-06-24 15:13:35 +02:00
parent 41c2a1023a
commit 3fa80a53c6
10 changed files with 136 additions and 100 deletions

View File

@@ -21,10 +21,11 @@ from json import JSONDecodeError
from requests.exceptions import HTTPError, SSLError
from src.errors.friendly_error import FriendlyError
from src.game import Game
from src.store.managers.async_manager import AsyncManager
from src.store.managers.online_cover_manager import OnlineCoverManager
from src.store.managers.local_cover_manager import LocalCoverManager
from src.store.managers.online_cover_manager import OnlineCoverManager
from src.store.managers.steam_api_manager import SteamAPIManager
from src.utils.steamgriddb import SGDBAuthError, SGDBHelper
@@ -39,7 +40,10 @@ class SGDBManager(AsyncManager):
try:
sgdb = SGDBHelper()
sgdb.conditionaly_update_cover(game)
except SGDBAuthError:
except SGDBAuthError as error:
# If invalid auth, cancel all SGDBManager tasks
self.cancellable.cancel()
raise
raise FriendlyError(
"Couldn't authenticate to SGDB",
"Verify your API key in the preferences",
) from error