fix: Drop superflous prefix when throwing module_error

This commit is contained in:
Michael Carlberg 2016-10-19 02:15:52 +02:00
parent f8e1c62a83
commit 1c882508ec
3 changed files with 8 additions and 10 deletions

View File

@ -34,9 +34,9 @@ namespace modules {
// Validate paths {{{ // Validate paths {{{
if (!file_util::exists(m_path_capacity)) if (!file_util::exists(m_path_capacity))
throw module_error("battery_module: The file '" + m_path_capacity + "' does not exist"); throw module_error("The file '" + m_path_capacity + "' does not exist");
if (!file_util::exists(m_path_adapter)) if (!file_util::exists(m_path_adapter))
throw module_error("battery_module: The file '" + m_path_adapter + "' does not exist"); throw module_error("The file '" + m_path_adapter + "' does not exist");
// }}} // }}}
// Add formats and elements {{{ // Add formats and elements {{{

View File

@ -69,7 +69,7 @@ namespace modules {
} }
} catch (const std::exception& err) { } catch (const std::exception& err) {
m_log.err("%s: %s", name(), err.what()); m_log.err("%s: %s", name(), err.what());
throw module_error(name() + ": Failed to execute tail command, stopping module..."); throw module_error("Failed to execute tail command, stopping module...");
} }
if (!m_command) if (!m_command)
@ -98,7 +98,7 @@ namespace modules {
cmd->tail([this](string contents) { m_output = contents; }); cmd->tail([this](string contents) { m_output = contents; });
} catch (const std::exception& err) { } catch (const std::exception& err) {
m_log.err("%s: %s", name(), err.what()); m_log.err("%s: %s", name(), err.what());
throw module_error(name() + ": Failed to execute command, stopping module..."); throw module_error("Failed to execute command, stopping module...");
} }
if (m_output == m_prev) if (m_output == m_prev)

View File

@ -31,19 +31,17 @@ namespace modules {
GET_CONFIG_VALUE(name(), m_headphoneid, "headphone-id"); GET_CONFIG_VALUE(name(), m_headphoneid, "headphone-id");
if (!headphone_mixer.empty() && m_headphoneid == -1) if (!headphone_mixer.empty() && m_headphoneid == -1)
throw module_error( throw module_error("Missing required property value for \"headphone-id\"...");
"volume_module: Missing required property value for \"headphone-id\"...");
else if (headphone_mixer.empty() && m_headphoneid != -1) else if (headphone_mixer.empty() && m_headphoneid != -1)
throw module_error( throw module_error("Missing required property value for \"headphone-mixer\"...");
"volume_module: Missing required property value for \"headphone-mixer\"...");
if (string_util::lower(speaker_mixer) == "master") if (string_util::lower(speaker_mixer) == "master")
throw module_error( throw module_error(
"volume_module: The \"Master\" mixer is already processed internally. Specify another " "The \"Master\" mixer is already processed internally. Specify another "
"mixer or comment out the \"speaker-mixer\" parameter..."); "mixer or comment out the \"speaker-mixer\" parameter...");
if (string_util::lower(headphone_mixer) == "master") if (string_util::lower(headphone_mixer) == "master")
throw module_error( throw module_error(
"volume_module: The \"Master\" mixer is already processed internally. Specify another " "The \"Master\" mixer is already processed internally. Specify another "
"mixer or comment out the \"headphone-mixer\" parameter..."); "mixer or comment out the \"headphone-mixer\" parameter...");
// }}} // }}}