mirror of
https://github.com/lutris/lutris
synced 2024-09-29 20:43:37 +00:00
Raise AuthenticationError from the service load() method if not authenticated.
Some services have odd errors that I don't understand, and I've just left those alone for now.
This commit is contained in:
parent
e2d3e6be3a
commit
f4d1e1a99f
|
@ -156,8 +156,8 @@ class AmazonService(OnlineService):
|
|||
def load(self):
|
||||
"""Load the user game library from the Amazon API"""
|
||||
if not self.is_connected():
|
||||
logger.error("User not connected to Amazon")
|
||||
return
|
||||
raise AuthenticationError("User not connected to Amazon", self.id)
|
||||
|
||||
games = [AmazonGame.new_from_amazon_game(game) for game in self.get_library()]
|
||||
for game in games:
|
||||
game.save()
|
||||
|
|
|
@ -295,7 +295,6 @@ class EpicGamesStoreService(OnlineService):
|
|||
try:
|
||||
library = self.get_library()
|
||||
except Exception as ex: # pylint=disable:broad-except
|
||||
logger.warning("EGS Token expired")
|
||||
raise AuthenticationError("EGS Token expired", self.id) from ex
|
||||
egs_games = []
|
||||
for game in library:
|
||||
|
|
|
@ -132,8 +132,8 @@ class GOGService(OnlineService):
|
|||
def load(self):
|
||||
"""Load the user game library from the GOG API"""
|
||||
if not self.is_connected():
|
||||
logger.error("User not connected to GOG")
|
||||
return
|
||||
raise AuthenticationError("User not connected to GOG", self.id)
|
||||
|
||||
games = [GOGGame.new_from_gog_game(game) for game in self.get_library()]
|
||||
for game in games:
|
||||
game.save()
|
||||
|
|
|
@ -8,7 +8,7 @@ from gettext import gettext as _
|
|||
from gi.repository import Gtk
|
||||
|
||||
from lutris import settings
|
||||
from lutris.exceptions import UnavailableGameError
|
||||
from lutris.exceptions import AuthenticationError, UnavailableGameError
|
||||
from lutris.gui.dialogs import HumbleBundleCookiesDialog, QuestionDialog
|
||||
from lutris.installer import AUTO_ELF_EXE, AUTO_WIN32_EXE
|
||||
from lutris.installer.installer_file import InstallerFile
|
||||
|
@ -115,7 +115,9 @@ class HumbleBundleService(OnlineService):
|
|||
try:
|
||||
library = self.get_library()
|
||||
except ValueError as ex:
|
||||
raise RuntimeError("Failed to get Humble Bundle library. Try logging out and back-in.") from ex
|
||||
raise AuthenticationError(
|
||||
"Failed to get Humble Bundle library. Try logging out and back-in.", self.id
|
||||
) from ex
|
||||
humble_games = []
|
||||
seen = set()
|
||||
for game in library:
|
||||
|
|
|
@ -9,7 +9,7 @@ from urllib.parse import quote_plus, urlencode
|
|||
|
||||
from lutris import settings
|
||||
from lutris.database import games as games_db
|
||||
from lutris.exceptions import UnavailableGameError
|
||||
from lutris.exceptions import AuthenticationError, UnavailableGameError
|
||||
from lutris.installer import AUTO_ELF_EXE, AUTO_WIN32_EXE
|
||||
from lutris.installer.installer_file import InstallerFile
|
||||
from lutris.services.base import SERVICE_LOGIN, OnlineService
|
||||
|
@ -144,8 +144,7 @@ class ItchIoService(OnlineService):
|
|||
def load(self):
|
||||
"""Load the user's itch.io library"""
|
||||
if not self.is_connected():
|
||||
logger.error("User not connected to itch.io")
|
||||
return
|
||||
raise AuthenticationError("User not connected to itch.io", self.id)
|
||||
|
||||
library = self.get_games()
|
||||
games = []
|
||||
|
|
Loading…
Reference in a new issue