improve exception handling in catfish

Bug #1307126 reported by flux242
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Catfish
Fix Released
Medium
Unassigned

Bug Description

I have the following exception running catfish 1.0.2. in ubuntu 14.04 beta2:

[code]
alex@xubuntu:~$ catfish

** (catfish.py:2477): WARNING **: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files
3.4
document-open-recent
Traceback (most recent call last):
  File "/usr/share/catfish/bin/catfish.py", line 44, in <module>
    catfish.main()
  File "/usr/share/catfish/catfish/__init__.py", line 74, in main
    window = CatfishWindow.CatfishWindow()
  File "/usr/share/catfish/catfish_lib/Window.py", line 49, in __new__
    new_object.finish_initializing(builder)
  File "/usr/share/catfish/catfish/CatfishWindow.py", line 228, in finish_initializing
    self.reload_symbolic_icons(self.icon_theme, builder)
  File "/usr/share/catfish/catfish/CatfishWindow.py", line 267, in reload_symbolic_icons
    modified_icon = self.load_symbolic_icon('document-open-recent', 16)
  File "/usr/share/catfish/catfish/CatfishWindow.py", line 389, in load_symbolic_icon
    icon = icon_info.load_symbolic(color, color, color, color)[0]
gi._glib.GError: Unrecognized image file format
[/code]

There something wrong with the librsvg or with python glib bindings one day before the official 14.04 lts release (sic!)
There's AttributeError exception handler in the code:
[code]
/usr/share/catfish/catfish/CatfishWindow.py
    def load_symbolic_icon(self, icon_name, size, state=Gtk.StateFlags.ACTIVE):
        """Return the symbolic version of icon_name, or the non-symbolic
        fallback if unavailable."""
        context = self.sidebar.get_style_context()
        print (pyversion)
        print (icon_name)
        try:
            icon_lookup_flags = Gtk.IconLookupFlags.FORCE_SVG
            icon_info = self.icon_theme.choose_icon([icon_name + '-symbolic'],
                                                    size,
                                                    icon_lookup_flags)
            color = context.get_color(state)
            icon = icon_info.load_symbolic(color, color, color, color)[0]
        except : # AttributeError
            icon_lookup_flags = Gtk.IconLookupFlags.FORCE_SVG | \
                Gtk.IconLookupFlags.USE_BUILTIN | \
                Gtk.IconLookupFlags.GENERIC_FALLBACK
            icon = self.icon_theme.load_icon(
                icon_name, size, icon_lookup_flags)
        return icon
[code]

As you can see this is not enough. Simple workaround is to catch all exceptions as you in the code above. In this case catfish starts and works and only some icons are missing. But I still can work with it

Revision history for this message
Sean Davis (bluesabre) wrote :

I've extended the Exception handling to also include GLib.GError... there should be nothing else that would be caught here.

Changed in catfish-search:
status: New → Fix Committed
importance: Undecided → Medium
Sean Davis (bluesabre)
Changed in catfish-search:
milestone: none → 1.0.3
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.