[geary/mjog/misc-fixes: 5/5] Report errors opening Application.Controller with a UI
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/misc-fixes: 5/5] Report errors opening Application.Controller with a UI
- Date: Mon, 2 Dec 2019 12:15:03 +0000 (UTC)
commit 57284a3e25206c563197ad94bda813ad79bf1cb1
Author: Michael Gratton <mike vee net>
Date: Mon Dec 2 20:01:19 2019 +0800
Report errors opening Application.Controller with a UI
Instead of logging errors, open a ProblemReportDialog.
Should help with issues like #30 and #600.
src/client/application/application-client.vala | 27 ++++++++++--
src/client/application/application-controller.vala | 48 +++++++---------------
2 files changed, 39 insertions(+), 36 deletions(-)
---
diff --git a/src/client/application/application-client.vala b/src/client/application/application-client.vala
index 2eef6a7f..4b573c44 100644
--- a/src/client/application/application-client.vala
+++ b/src/client/application/application-client.vala
@@ -833,8 +833,10 @@ public class Application.Client : Gtk.Application {
// Opens the controller
private async void create_controller() {
bool first_run = false;
+ bool open_failed = false;
+ int mutex_token = Geary.Nonblocking.Mutex.INVALID_TOKEN;
try {
- int mutex_token = yield this.controller_mutex.claim_async();
+ mutex_token = yield this.controller_mutex.claim_async();
if (this.controller == null) {
message(
"%s %s%s prefix=%s exec_dir=%s is_installed=%s",
@@ -851,9 +853,28 @@ public class Application.Client : Gtk.Application {
);
first_run = !this.engine.has_accounts;
}
- this.controller_mutex.release(ref mutex_token);
} catch (Error err) {
- error("Error creating controller: %s", err.message);
+ open_failed = true;
+ warning("Error creating controller: %s", err.message);
+ var dialog = new Dialogs.ProblemDetailsDialog(
+ null,
+ this,
+ new Geary.ProblemReport(err)
+ );
+ dialog.run();
+ }
+
+ if (mutex_token != Geary.Nonblocking.Mutex.INVALID_TOKEN) {
+ try {
+ this.controller_mutex.release(ref mutex_token);
+ } catch (GLib.Error error) {
+ warning("Failed to release controller mutex: %s",
+ error.message);
+ }
+ }
+
+ if (open_failed) {
+ quit();
}
if (first_run) {
diff --git a/src/client/application/application-controller.vala
b/src/client/application/application-controller.vala
index 8155804f..ba3b6bd8 100644
--- a/src/client/application/application-controller.vala
+++ b/src/client/application/application-controller.vala
@@ -121,7 +121,8 @@ internal class Application.Controller : Geary.BaseObject {
* Constructs a new instance of the controller.
*/
public async Controller(Client application,
- GLib.Cancellable cancellable) {
+ GLib.Cancellable cancellable)
+ throws GLib.Error {
this.application = application;
this.controller_open = cancellable;
@@ -139,16 +140,14 @@ internal class Application.Controller : Geary.BaseObject {
this.application.get_web_extensions_dir(),
this.application.get_user_cache_directory().get_child("web-resources")
);
- try {
- Components.WebView.load_resources(
- this.application.get_user_config_directory()
- );
- Composer.WebView.load_resources();
- ConversationWebView.load_resources();
- Accounts.SignatureWebView.load_resources();
- } catch (Error err) {
- error("Error loading web resources: %s", err.message);
- }
+ Components.WebView.load_resources(
+ this.application.get_user_config_directory()
+ );
+ Composer.WebView.load_resources();
+ ConversationWebView.load_resources();
+ Accounts.SignatureWebView.load_resources();
+
+ throw new Geary.EngineError.UNSUPPORTED("testing..");
this.folks = Folks.IndividualAggregator.dup();
if (!this.folks.is_prepared) {
@@ -173,12 +172,8 @@ internal class Application.Controller : Geary.BaseObject {
this.plugin_manager.load();
// Migrate configuration if necessary.
- try {
- Migrate.xdg_config_dir(this.application.get_user_data_directory(),
- this.application.get_user_config_directory());
- } catch (Error e) {
- error("Error migrating configuration directories: %s", e.message);
- }
+ Migrate.xdg_config_dir(this.application.get_user_data_directory(),
+ this.application.get_user_config_directory());
// Hook up cert, accounts and credentials machinery
@@ -187,12 +182,7 @@ internal class Application.Controller : Geary.BaseObject {
cancellable
);
- SecretMediator? libsecret = null;
- try {
- libsecret = yield new SecretMediator(cancellable);
- } catch (GLib.Error err) {
- error("Error opening libsecret: %s", err.message);
- }
+ SecretMediator? libsecret = yield new SecretMediator(cancellable);
application.engine.account_available.connect(on_account_available);
@@ -214,18 +204,10 @@ internal class Application.Controller : Geary.BaseObject {
on_report_problem
);
- try {
- yield this.account_manager.connect_goa(cancellable);
- } catch (GLib.Error err) {
- warning("Error opening GOA: %s", err.message);
- }
+ yield this.account_manager.connect_goa(cancellable);
// Start loading accounts
- try {
- yield this.account_manager.load_accounts(cancellable);
- } catch (Error e) {
- warning("Error loading accounts: %s", e.message);
- }
+ yield this.account_manager.load_accounts(cancellable);
// Expunge any deleted accounts in the background, so we're
// not blocking the app continuing to open.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]