Merge ~nteodosio/software-properties:catch-exception into software-properties:ubuntu/master

Proposed by Nathan Teodosio
Status: Merged
Approved by: Sebastien Bacher
Approved revision: 50d5192ae64cabced9b1f23f05a84b1578728768
Merged at revision: 684756fd2c9d606071a23dd97352cdf572b531f5
Proposed branch: ~nteodosio/software-properties:catch-exception
Merge into: software-properties:ubuntu/master
Diff against target: 12 lines (+2/-0)
1 file modified
softwareproperties/gtk/DialogUaAttach.py (+2/-0)
Reviewer Review Type Date Requested Status
Sebastien Bacher Approve
Review via email: mp+436428@code.launchpad.net

Description of the change

    Polling: Catch any exception to wait()

    Uncaught exceptions to wait will trigger error reports even though
    it's only the polling thread that dies:
    https://launchpad.net/bugs/2003996

    They are caused by connectivity issues.

    This is temporary until a UX plan has been devised to warn the user
    about the connectivity issue.

To post a comment you must log in.
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks. Should we be more specific about the exception we catch there and maybe display a string indicating the context in addition of the exception?

Like catch TimeoutError print("Error getting the ubuntu pro token")

review: Needs Information
Revision history for this message
Nathan Teodosio (nteodosio) wrote :

I think printing the context is indeed a good idea, but unsure about
catching specific exceptions.

The UA API[1] does not even list TimeoutError, it is raised by SSL, so
maybe by trying to be more specific we might not exhaust the list of
possibilities?

[1]:
https://github.com/canonical/ubuntu-advantage-client/blob/main/docs/references/api.md#raised-exceptions-2

Revision history for this message
Sebastien Bacher (seb128) wrote :

right, let's try to not be over specific and don't limit to TimeoutError

Revision history for this message
Nathan Teodosio (nteodosio) wrote :

Thanks for the suggestion, force pushed.

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/softwareproperties/gtk/DialogUaAttach.py b/softwareproperties/gtk/DialogUaAttach.py
2index 4959b14..7c7f89d 100644
3--- a/softwareproperties/gtk/DialogUaAttach.py
4+++ b/softwareproperties/gtk/DialogUaAttach.py
5@@ -147,6 +147,8 @@ class DialogUaAttach:
6 GLib.idle_add(self.update_state, 'pin_validated')
7 except MagicAttachTokenError:
8 GLib.idle_add(self.update_state, 'expired')
9+ except Exception as e:
10+ print("Error getting the Ubuntu Pro token: ", e)
11 finally:
12 self.poll = None
13

Subscribers

People subscribed via source and target branches