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

View File

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

View File

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

View File

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

View File

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

View File

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