getting-things-gnome / gtg

Getting Things GNOME! trunk
https://wiki.gnome.org/Apps/GTG
GNU General Public License v3.0
559 stars 164 forks source link

Traceback on startup when wrong CalDAV password is stored in preferences #901

Open symphorien opened 2 years ago

symphorien commented 2 years ago

When opening gtg0.6 for some reason the caldav password is reset to empty (this is another issue that I will open shortly).

This triggers the following traceback:

GNOME keyring not found, passwords will be not stored after restarting GTG
2022-06-04 15:03:50,119 - INFO - backend_caldav:_do_periodic_import:137 - Running periodic import
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/nix/store/553d7c4xcwp9j1a1gb9cb1s9ry3x1pi9-python3-3.9.13/lib/python3.9/threading.py", line 980, in _bootstrap_inner
    self.run()
  File "/nix/store/553d7c4xcwp9j1a1gb9cb1s9ry3x1pi9-python3-3.9.13/lib/python3.9/threading.py", line 917, in run
    self._target(*self._args, **self._kwargs)
  File "/nix/store/yj93k4i7pa3klm7bzvvnrmkxajkbp7sk-gtg-0.6/lib/python3.9/site-packages/GTG/core/datastore.py", line 499, in __backend_startup
    backend.start_get_tasks()
  File "/nix/store/yj93k4i7pa3klm7bzvvnrmkxajkbp7sk-gtg-0.6/lib/python3.9/site-packages/GTG/core/datastore.py", line 694, in start_get_tasks
    self.backend.start_get_tasks()
  File "/nix/store/yj93k4i7pa3klm7bzvvnrmkxajkbp7sk-gtg-0.6/lib/python3.9/site-packages/GTG/core/interruptible.py", line 38, in new
    return fn(*args)
  File "/nix/store/yj93k4i7pa3klm7bzvvnrmkxajkbp7sk-gtg-0.6/lib/python3.9/site-packages/GTG/backends/periodic_import_backend.py", line 79, in start_get_tasks
    self._start_get_tasks()
  File "/nix/store/yj93k4i7pa3klm7bzvvnrmkxajkbp7sk-gtg-0.6/lib/python3.9/site-packages/GTG/backends/periodic_import_backend.py", line 98, in _start_get_tasks
    self.do_periodic_import()
  File "/nix/store/yj93k4i7pa3klm7bzvvnrmkxajkbp7sk-gtg-0.6/lib/python3.9/site-packages/GTG/core/interruptible.py", line 38, in new
    return fn(*args)
  File "/nix/store/yj93k4i7pa3klm7bzvvnrmkxajkbp7sk-gtg-0.6/lib/python3.9/site-packages/GTG/backends/backend_caldav.py", line 111, in do_periodic_import
    self._do_periodic_import()
  File "/nix/store/yj93k4i7pa3klm7bzvvnrmkxajkbp7sk-gtg-0.6/lib/python3.9/site-packages/GTG/backends/backend_caldav.py", line 139, in _do_periodic_import
    self._refresh_calendar_list()
  File "/nix/store/yj93k4i7pa3klm7bzvvnrmkxajkbp7sk-gtg-0.6/lib/python3.9/site-packages/GTG/backends/backend_caldav.py", line 227, in _refresh_calendar_list
    raise error
  File "/nix/store/yj93k4i7pa3klm7bzvvnrmkxajkbp7sk-gtg-0.6/lib/python3.9/site-packages/GTG/backends/backend_caldav.py", line 218, in _refresh_calendar_list
    principal = self._dav_client.principal()
  File "/nix/store/q0wikq9am3rm1vg70ky1lxyz8mhcc26y-python3.9-caldav-0.9.1/lib/python3.9/site-packages/caldav/davclient.py", line 362, in principal
    self._principal = Principal(client=self, *largs, **kwargs)
  File "/nix/store/q0wikq9am3rm1vg70ky1lxyz8mhcc26y-python3.9-caldav-0.9.1/lib/python3.9/site-packages/caldav/objects.py", line 404, in __init__
    cup = self.get_property(dav.CurrentUserPrincipal())
  File "/nix/store/q0wikq9am3rm1vg70ky1lxyz8mhcc26y-python3.9-caldav-0.9.1/lib/python3.9/site-packages/caldav/objects.py", line 175, in get_property
    foo = self.get_properties([prop], **passthrough)
  File "/nix/store/q0wikq9am3rm1vg70ky1lxyz8mhcc26y-python3.9-caldav-0.9.1/lib/python3.9/site-packages/caldav/objects.py", line 198, in get_properties
    response = self._query_properties(props, depth)
  File "/nix/store/q0wikq9am3rm1vg70ky1lxyz8mhcc26y-python3.9-caldav-0.9.1/lib/python3.9/site-packages/caldav/objects.py", line 142, in _query_properties
    return self._query(root, depth)
  File "/nix/store/q0wikq9am3rm1vg70ky1lxyz8mhcc26y-python3.9-caldav-0.9.1/lib/python3.9/site-packages/caldav/objects.py", line 160, in _query
    ret = getattr(self.client, query_method)(
  File "/nix/store/q0wikq9am3rm1vg70ky1lxyz8mhcc26y-python3.9-caldav-0.9.1/lib/python3.9/site-packages/caldav/davclient.py", line 410, in propfind
    return self.request(url or self.url, "PROPFIND", props,
  File "/nix/store/q0wikq9am3rm1vg70ky1lxyz8mhcc26y-python3.9-caldav-0.9.1/lib/python3.9/site-packages/caldav/davclient.py", line 590, in request
    raise error.AuthorizationError(url=str(url), reason = reason)
caldav.lib.error.AuthorizationError: AuthorizationError at 'https://radicale.xlumurb.eu', reason Unauthorized
Traceback (most recent call last):
  File "/nix/store/yj93k4i7pa3klm7bzvvnrmkxajkbp7sk-gtg-0.6/lib/python3.9/site-packages/GTG/gtk/browser/main_window.py", line 1624, in on_backend_needing_interaction
    infobar.set_interaction_request(description, interaction_type, callback)
AttributeError: 'NoneType' object has no attribute 'set_interaction_request'

gtg should handle the authentication error gracefully.

Context: Global generic exception

Traceback (most recent call last):
  File "/nix/store/yj93k4i7pa3klm7bzvvnrmkxajkbp7sk-gtg-0.6/lib/python3.9/site-packages/GTG/gtk/browser/main_window.py", line 1624, in on_backend_needing_interaction
    infobar.set_interaction_request(description, interaction_type, callback)
AttributeError: 'NoneType' object has no attribute 'set_interaction_request'

Software versions:

Neui commented 2 years ago

I agree, GTG should handles errors more gracefully in general (like the hamster plugin problem things).

Looking at the last exception, infobar is None, which according to the code is returned by self._new_infobar(), except that it only returns None if self.vbox_toolbars is falsy (such as None), and self.vbox_toolbars is set to an builder object of the same name. Doing a grep for vbox_toolbars just shows me results in the used main_window.py file, but not in any other file (like main_window.ui which I would have expected). Did something accidentally lost while working on that main_window.ui file?

nekohayo commented 9 months ago

Somewhat related, but presumably not the same: #845