diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-11-23 01:23:20 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-11-23 01:23:20 +0100 |
| commit | a988cabec09c28ba11a0e46f0acdc564aa04baca (patch) | |
| tree | 2e5cd0e1dc2710d30e8055f836b55a6929c87df4 | |
| parent | 38643ec631074ae628a4c414a1e7a3462aba19ed (diff) | |
Clarify error messages about missing configuration.
| -rw-r--r-- | src/lib/exceptions.h | 9 | ||||
| -rw-r--r-- | src/lib/job.cc | 6 | ||||
| -rw-r--r-- | src/lib/kdm_with_metadata.cc | 4 | ||||
| -rw-r--r-- | src/lib/send_notification_email_job.cc | 2 |
4 files changed, 18 insertions, 3 deletions
diff --git a/src/lib/exceptions.h b/src/lib/exceptions.h index 80d4801da..10231f59a 100644 --- a/src/lib/exceptions.h +++ b/src/lib/exceptions.h @@ -471,4 +471,13 @@ public: }; +class MissingConfigurationError : public std::runtime_error +{ +public: + explicit MissingConfigurationError(std::string s) + : std::runtime_error(s) + {} +}; + + #endif diff --git a/src/lib/job.cc b/src/lib/job.cc index 2a4c891ed..9c9530b7a 100644 --- a/src/lib/job.cc +++ b/src/lib/job.cc @@ -242,6 +242,12 @@ Job::run_wrapper () set_progress(1); set_state(FINISHED_ERROR); + } catch (MissingConfigurationError& e) { + + set_error(e.what()); + set_progress(1); + set_state(FINISHED_ERROR); + } catch (std::exception& e) { set_error ( diff --git a/src/lib/kdm_with_metadata.cc b/src/lib/kdm_with_metadata.cc index 86573f43b..10054f01e 100644 --- a/src/lib/kdm_with_metadata.cc +++ b/src/lib/kdm_with_metadata.cc @@ -210,11 +210,11 @@ send_emails ( auto config = Config::instance (); if (config->mail_server().empty()) { - throw NetworkError (_("No mail server configured in preferences")); + throw MissingConfigurationError(_("No outgoing mail server configured in the Email tab of preferences")); } if (config->kdm_from().empty()) { - throw NetworkError(_("No KDM from address configured in preferences")); + throw MissingConfigurationError(_("No from address configured in the KDM Email tab of preferences")); } for (auto const& kdms_for_cinema: kdms) { diff --git a/src/lib/send_notification_email_job.cc b/src/lib/send_notification_email_job.cc index 2dd1f63f2..f40e8fefa 100644 --- a/src/lib/send_notification_email_job.cc +++ b/src/lib/send_notification_email_job.cc @@ -67,7 +67,7 @@ SendNotificationEmailJob::run () auto config = Config::instance (); if (config->mail_server().empty()) { - throw NetworkError (_("No mail server configured in preferences")); + throw MissingConfigurationError(_("No outgoing mail server configured in the Email tab of preferences")); } set_progress_unknown (); |
