Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error handling #53

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Improve error handling #53

wants to merge 3 commits into from

Conversation

jan-kiszka
Copy link
Collaborator

Makes the addon more robust in case of connection losses to the broker or even the native messaging host.

The loop will only stop if f() returned true. Therefore, we can predict
its return code and don't need to call it once more.

Signed-off-by: Jan Kiszka <[email protected]>
This also catches problems of the native messaging host. If it stalls,
the browser will stall as well. 10 seconds should be enough time for it
to react. Fail waitFor if that limit is reached and handle the failure
at the caller sites.

Signed-off-by: Jan Kiszka <[email protected]>
@jan-kiszka jan-kiszka requested a review from fmoessbauer January 7, 2025 07:31
background.js Outdated
@@ -377,6 +377,7 @@ async function on_message_native(response) {
} else {
ssoLog("lost connection to broker");
broker_online = false;
logout();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks on-demand dbus activation and was removed in 04c06aa#diff-bb06783fccd762e4d905ab922491e954a9fbaf708a1acbf53dff92872b0bcd3bL335.

For details, see #33.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it's still broken. We need to signal that the broker is offline, also visually.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessarily. It is fine if the broker is offline as it will get restarted on the next DBus call. If we logout, the next hit of the Entra login page will not even try to start it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But visualization is broken - I will fix that instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might give a slight indication that the broker is offline. But in the end, the user should not need to care and should also not be disturbed by that. For (caller activated) DBus services the caller should not assume anything about the current state of the service. Instead it should just make the call and check the return code - which indicates the error reason.

Signaling availability makes no sense if the broker is offline as we
cannot request or update the PRT in that case.

Signed-off-by: Jan Kiszka <[email protected]>
@jan-kiszka
Copy link
Collaborator Author

Now it works perfectly - without logging out.

@fmoessbauer
Copy link
Member

I already merged the first two commits to master. The last one still needs changes to distinguish between the "mostly irrelevant" broker-currently-offline state and the logged-in state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants