Use the correct type for GErrors

This commit is contained in:
kramo
2023-12-17 00:25:01 +01:00
parent bcc3c57117
commit 7d0b9854d3
6 changed files with 14 additions and 14 deletions

View File

@@ -286,7 +286,7 @@ class DetailsWindow(Adw.Window):
def set_cover(self, _source: Any, result: Gio.Task, *_args: Any) -> None:
try:
path = self.image_file_dialog.open_finish(result).get_path()
except GLib.GError:
except GLib.Error:
return
def thread_func() -> None:
@@ -319,7 +319,7 @@ class DetailsWindow(Adw.Window):
def set_executable(self, _source: Any, result: Gio.Task, *_args: Any) -> None:
try:
path = self.exec_file_dialog.open_finish(result).get_path()
except GLib.GError:
except GLib.Error:
return
self.executable.set_text(shlex.quote(path))

View File

@@ -93,7 +93,7 @@ class DesktopSourceIterable(SourceIterable):
executable = keyfile.get_string("Desktop Entry", "Exec").split(
" %"
)[0]
except GLib.GError:
except GLib.Error:
continue
try:
@@ -101,7 +101,7 @@ class DesktopSourceIterable(SourceIterable):
if not self.check_command(try_exec):
continue
except GLib.GError:
except GLib.Error:
pass
# Skip Steam games
@@ -119,13 +119,13 @@ class DesktopSourceIterable(SourceIterable):
try:
if keyfile.get_boolean("Desktop Entry", "NoDisplay"):
continue
except GLib.GError:
except GLib.Error:
pass
try:
if keyfile.get_boolean("Desktop Entry", "Hidden"):
continue
except GLib.GError:
except GLib.Error:
pass
# Strip /run/host from Flatpak paths
@@ -147,7 +147,7 @@ class DesktopSourceIterable(SourceIterable):
try:
icon_str = keyfile.get_string("Desktop Entry", "Icon")
except GLib.GError:
except GLib.Error:
yield game
continue
else:
@@ -170,7 +170,7 @@ class DesktopSourceIterable(SourceIterable):
.get_path()
):
additional_data = {"local_icon_path": Path(icon_path)}
except GLib.GError:
except GLib.Error:
pass
yield (game, additional_data)

View File

@@ -76,7 +76,7 @@ class FlatpakSourceIterable(SourceIterable):
name = keyfile.get_string("Desktop Entry", "Name")
except GLib.GError:
except GLib.Error:
continue
values = {
@@ -106,7 +106,7 @@ class FlatpakSourceIterable(SourceIterable):
additional_data = {"local_icon_path": Path(icon_path)}
else:
pass
except GLib.GError:
except GLib.Error:
pass
yield (game, additional_data)

View File

@@ -393,7 +393,7 @@ class PreferencesWindow(Adw.PreferencesWindow):
"""Callback called when a dir picker button is clicked"""
try:
path = Path(self.file_chooser.select_folder_finish(result).get_path())
except GLib.GError:
except GLib.Error:
return
# Good picked location

View File

@@ -82,7 +82,7 @@ def convert_cover(
tmp_path := Gio.File.new_tmp("XXXXXX.tiff")[0].get_path()
)
return convert_cover(tmp_path)
except GLib.GError:
except GLib.Error:
return None
return tmp_path

View File

@@ -204,7 +204,7 @@ class SearchCartridgesService(Server, Gio.Application):
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
str(path), -1, 32, True
)
except GLib.GError as e:
except GLib.Error as e:
print(e)
continue
elif (path := shared.covers_dir / (game_id + ".gif")).is_file():
@@ -212,7 +212,7 @@ class SearchCartridgesService(Server, Gio.Application):
pixbuf = GdkPixbuf.PixbufAnimation.new_from_file(
str(path)
).get_static_image()
except GLib.GError as e:
except GLib.Error as e:
print(e)
continue
d = {