mpd_error.h: remove obsolete header
Migrate the remaining callers to FatalError().
This commit is contained in:
parent
3330aa6f6a
commit
7a4c9f5f4c
|
@ -66,8 +66,7 @@ mpd_headers = \
|
||||||
src/replay_gain_info.h \
|
src/replay_gain_info.h \
|
||||||
src/TimePrint.cxx src/TimePrint.hxx \
|
src/TimePrint.cxx src/TimePrint.hxx \
|
||||||
src/stats.h \
|
src/stats.h \
|
||||||
src/Timer.hxx \
|
src/Timer.hxx
|
||||||
src/mpd_error.h
|
|
||||||
|
|
||||||
src_mpd_SOURCES = \
|
src_mpd_SOURCES = \
|
||||||
$(mpd_headers) \
|
$(mpd_headers) \
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
#include "ConfigData.hxx"
|
#include "ConfigData.hxx"
|
||||||
#include "ConfigGlobal.hxx"
|
#include "ConfigGlobal.hxx"
|
||||||
#include "ConfigOption.hxx"
|
#include "ConfigOption.hxx"
|
||||||
#include "mpd_error.h"
|
|
||||||
#include "util/Error.hxx"
|
#include "util/Error.hxx"
|
||||||
|
#include "system/FatalError.hxx"
|
||||||
|
|
||||||
static AudioFormat configured_audio_format;
|
static AudioFormat configured_audio_format;
|
||||||
|
|
||||||
|
@ -47,6 +47,6 @@ void initAudioConfig(void)
|
||||||
Error error;
|
Error error;
|
||||||
if (!audio_format_parse(configured_audio_format, param->value,
|
if (!audio_format_parse(configured_audio_format, param->value,
|
||||||
true, error))
|
true, error))
|
||||||
MPD_ERROR("error parsing line %i: %s",
|
FormatFatalError("error parsing line %i: %s",
|
||||||
param->line, error.GetMessage());
|
param->line, error.GetMessage());
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,11 +30,11 @@
|
||||||
#include "InputPlugin.hxx"
|
#include "InputPlugin.hxx"
|
||||||
#include "PlaylistRegistry.hxx"
|
#include "PlaylistRegistry.hxx"
|
||||||
#include "PlaylistPlugin.hxx"
|
#include "PlaylistPlugin.hxx"
|
||||||
#include "mpd_error.h"
|
|
||||||
#include "fs/Path.hxx"
|
#include "fs/Path.hxx"
|
||||||
#include "fs/FileSystem.hxx"
|
#include "fs/FileSystem.hxx"
|
||||||
#include "util/Error.hxx"
|
#include "util/Error.hxx"
|
||||||
#include "util/Domain.hxx"
|
#include "util/Domain.hxx"
|
||||||
|
#include "system/FatalError.hxx"
|
||||||
|
|
||||||
#ifdef ENABLE_ENCODER
|
#ifdef ENABLE_ENCODER
|
||||||
#include "EncoderList.hxx"
|
#include "EncoderList.hxx"
|
||||||
|
@ -185,7 +185,7 @@ parse_cmdline(int argc, char **argv, struct options *options,
|
||||||
g_option_context_free(context);
|
g_option_context_free(context);
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
MPD_ERROR("option parsing failed: %s\n", gerror->message);
|
FatalError("option parsing failed", gerror);
|
||||||
|
|
||||||
if (option_version)
|
if (option_version)
|
||||||
version();
|
version();
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
#include "util/Error.hxx"
|
#include "util/Error.hxx"
|
||||||
#include "fs/Path.hxx"
|
#include "fs/Path.hxx"
|
||||||
#include "system/FatalError.hxx"
|
#include "system/FatalError.hxx"
|
||||||
#include "mpd_error.h"
|
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include "ConfigPath.hxx"
|
#include "ConfigPath.hxx"
|
||||||
#include "fs/Path.hxx"
|
#include "fs/Path.hxx"
|
||||||
#include "util/Error.hxx"
|
#include "util/Error.hxx"
|
||||||
#include "mpd_error.h"
|
#include "system/FatalError.hxx"
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
|
@ -125,8 +125,8 @@ config_get_unsigned(ConfigOption option, unsigned default_value)
|
||||||
|
|
||||||
value = strtol(param->value, &endptr, 0);
|
value = strtol(param->value, &endptr, 0);
|
||||||
if (*endptr != 0 || value < 0)
|
if (*endptr != 0 || value < 0)
|
||||||
MPD_ERROR("Not a valid non-negative number in line %i",
|
FormatFatalError("Not a valid non-negative number in line %i",
|
||||||
param->line);
|
param->line);
|
||||||
|
|
||||||
return (unsigned)value;
|
return (unsigned)value;
|
||||||
}
|
}
|
||||||
|
@ -143,10 +143,11 @@ config_get_positive(ConfigOption option, unsigned default_value)
|
||||||
|
|
||||||
value = strtol(param->value, &endptr, 0);
|
value = strtol(param->value, &endptr, 0);
|
||||||
if (*endptr != 0)
|
if (*endptr != 0)
|
||||||
MPD_ERROR("Not a valid number in line %i", param->line);
|
FormatFatalError("Not a valid number in line %i", param->line);
|
||||||
|
|
||||||
if (value <= 0)
|
if (value <= 0)
|
||||||
MPD_ERROR("Not a positive number in line %i", param->line);
|
FormatFatalError("Not a positive number in line %i",
|
||||||
|
param->line);
|
||||||
|
|
||||||
return (unsigned)value;
|
return (unsigned)value;
|
||||||
}
|
}
|
||||||
|
@ -162,9 +163,9 @@ config_get_bool(ConfigOption option, bool default_value)
|
||||||
|
|
||||||
success = get_bool(param->value, &value);
|
success = get_bool(param->value, &value);
|
||||||
if (!success)
|
if (!success)
|
||||||
MPD_ERROR("Expected boolean value (yes, true, 1) or "
|
FormatFatalError("Expected boolean value (yes, true, 1) or "
|
||||||
"(no, false, 0) on line %i\n",
|
"(no, false, 0) on line %i\n",
|
||||||
param->line);
|
param->line);
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include "DecoderPlugin.hxx"
|
#include "DecoderPlugin.hxx"
|
||||||
#include "ConfigGlobal.hxx"
|
#include "ConfigGlobal.hxx"
|
||||||
#include "ConfigData.hxx"
|
#include "ConfigData.hxx"
|
||||||
#include "mpd_error.h"
|
|
||||||
#include "decoder/AudiofileDecoderPlugin.hxx"
|
#include "decoder/AudiofileDecoderPlugin.hxx"
|
||||||
#include "decoder/PcmDecoderPlugin.hxx"
|
#include "decoder/PcmDecoderPlugin.hxx"
|
||||||
#include "decoder/DsdiffDecoderPlugin.hxx"
|
#include "decoder/DsdiffDecoderPlugin.hxx"
|
||||||
|
@ -43,6 +42,7 @@
|
||||||
#include "decoder/ModplugDecoderPlugin.hxx"
|
#include "decoder/ModplugDecoderPlugin.hxx"
|
||||||
#include "decoder/MpcdecDecoderPlugin.hxx"
|
#include "decoder/MpcdecDecoderPlugin.hxx"
|
||||||
#include "decoder/FluidsynthDecoderPlugin.hxx"
|
#include "decoder/FluidsynthDecoderPlugin.hxx"
|
||||||
|
#include "system/FatalError.hxx"
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
|
@ -204,8 +204,8 @@ decoder_plugin_config(const char *plugin_name)
|
||||||
while ((param = config_get_next_param(CONF_DECODER, param)) != NULL) {
|
while ((param = config_get_next_param(CONF_DECODER, param)) != NULL) {
|
||||||
const char *name = param->GetBlockValue("plugin");
|
const char *name = param->GetBlockValue("plugin");
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
MPD_ERROR("decoder configuration without 'plugin' name in line %d",
|
FormatFatalError("decoder configuration without 'plugin' name in line %d",
|
||||||
param->line);
|
param->line);
|
||||||
|
|
||||||
if (strcmp(name, plugin_name) == 0)
|
if (strcmp(name, plugin_name) == 0)
|
||||||
return param;
|
return param;
|
||||||
|
|
|
@ -26,9 +26,9 @@
|
||||||
#include "system/FatalError.hxx"
|
#include "system/FatalError.hxx"
|
||||||
#include "fs/Path.hxx"
|
#include "fs/Path.hxx"
|
||||||
#include "fs/FileSystem.hxx"
|
#include "fs/FileSystem.hxx"
|
||||||
#include "mpd_error.h"
|
|
||||||
#include "util/Error.hxx"
|
#include "util/Error.hxx"
|
||||||
#include "util/Domain.hxx"
|
#include "util/Domain.hxx"
|
||||||
|
#include "system/FatalError.hxx"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -230,8 +230,8 @@ parse_log_level(const char *value, unsigned line)
|
||||||
else if (0 == strcmp(value, "verbose"))
|
else if (0 == strcmp(value, "verbose"))
|
||||||
return G_LOG_LEVEL_DEBUG;
|
return G_LOG_LEVEL_DEBUG;
|
||||||
else {
|
else {
|
||||||
MPD_ERROR("unknown log level \"%s\" at line %u\n",
|
FormatFatalError("unknown log level \"%s\" at line %u",
|
||||||
value, line);
|
value, line);
|
||||||
return G_LOG_LEVEL_MESSAGE;
|
return G_LOG_LEVEL_MESSAGE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include "ConfigData.hxx"
|
#include "ConfigData.hxx"
|
||||||
#include "ConfigGlobal.hxx"
|
#include "ConfigGlobal.hxx"
|
||||||
#include "ConfigOption.hxx"
|
#include "ConfigOption.hxx"
|
||||||
#include "mpd_error.h"
|
#include "system/FatalError.hxx"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -64,7 +64,7 @@ static unsigned parsePermissions(const char *string)
|
||||||
} else if (strcmp(temp, PERMISSION_ADMIN_STRING) == 0) {
|
} else if (strcmp(temp, PERMISSION_ADMIN_STRING) == 0) {
|
||||||
permission |= PERMISSION_ADMIN;
|
permission |= PERMISSION_ADMIN;
|
||||||
} else {
|
} else {
|
||||||
MPD_ERROR("unknown permission \"%s\"", temp);
|
FormatFatalError("unknown permission \"%s\"", temp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,10 +92,10 @@ void initPermissions(void)
|
||||||
strchr(param->value, PERMISSION_PASSWORD_CHAR);
|
strchr(param->value, PERMISSION_PASSWORD_CHAR);
|
||||||
|
|
||||||
if (separator == NULL)
|
if (separator == NULL)
|
||||||
MPD_ERROR("\"%c\" not found in password string "
|
FormatFatalError("\"%c\" not found in password string "
|
||||||
"\"%s\", line %i",
|
"\"%s\", line %i",
|
||||||
PERMISSION_PASSWORD_CHAR,
|
PERMISSION_PASSWORD_CHAR,
|
||||||
param->value, param->line);
|
param->value, param->line);
|
||||||
|
|
||||||
password = g_strndup(param->value,
|
password = g_strndup(param->value,
|
||||||
separator - param->value);
|
separator - param->value);
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
#include "util/Error.hxx"
|
#include "util/Error.hxx"
|
||||||
#include "ConfigGlobal.hxx"
|
#include "ConfigGlobal.hxx"
|
||||||
#include "ConfigData.hxx"
|
#include "ConfigData.hxx"
|
||||||
#include "mpd_error.h"
|
#include "system/FatalError.hxx"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -87,8 +87,8 @@ playlist_plugin_config(const char *plugin_name)
|
||||||
while ((param = config_get_next_param(CONF_PLAYLIST_PLUGIN, param)) != NULL) {
|
while ((param = config_get_next_param(CONF_PLAYLIST_PLUGIN, param)) != NULL) {
|
||||||
const char *name = param->GetBlockValue("name");
|
const char *name = param->GetBlockValue("name");
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
MPD_ERROR("playlist configuration without 'plugin' name in line %d",
|
FormatFatalError("playlist configuration without 'plugin' name in line %d",
|
||||||
param->line);
|
param->line);
|
||||||
|
|
||||||
if (strcmp(name, plugin_name) == 0)
|
if (strcmp(name, plugin_name) == 0)
|
||||||
return param;
|
return param;
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include "ConfigData.hxx"
|
#include "ConfigData.hxx"
|
||||||
#include "ConfigGlobal.hxx"
|
#include "ConfigGlobal.hxx"
|
||||||
#include "Playlist.hxx"
|
#include "Playlist.hxx"
|
||||||
#include "mpd_error.h"
|
#include "system/FatalError.hxx"
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
|
@ -86,8 +86,8 @@ void replay_gain_global_init(void)
|
||||||
const struct config_param *param = config_get_param(CONF_REPLAYGAIN);
|
const struct config_param *param = config_get_param(CONF_REPLAYGAIN);
|
||||||
|
|
||||||
if (param != NULL && !replay_gain_set_mode_string(param->value)) {
|
if (param != NULL && !replay_gain_set_mode_string(param->value)) {
|
||||||
MPD_ERROR("replaygain value \"%s\" at line %i is invalid\n",
|
FormatFatalError("replaygain value \"%s\" at line %i is invalid\n",
|
||||||
param->value, param->line);
|
param->value, param->line);
|
||||||
}
|
}
|
||||||
|
|
||||||
param = config_get_param(CONF_REPLAYGAIN_PREAMP);
|
param = config_get_param(CONF_REPLAYGAIN_PREAMP);
|
||||||
|
@ -97,13 +97,13 @@ void replay_gain_global_init(void)
|
||||||
float f = strtod(param->value, &test);
|
float f = strtod(param->value, &test);
|
||||||
|
|
||||||
if (*test != '\0') {
|
if (*test != '\0') {
|
||||||
MPD_ERROR("Replaygain preamp \"%s\" is not a number at "
|
FormatFatalError("Replaygain preamp \"%s\" is not a number at "
|
||||||
"line %i\n", param->value, param->line);
|
"line %i\n", param->value, param->line);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f < -15 || f > 15) {
|
if (f < -15 || f > 15) {
|
||||||
MPD_ERROR("Replaygain preamp \"%s\" is not between -15 and"
|
FormatFatalError("Replaygain preamp \"%s\" is not between -15 and"
|
||||||
"15 at line %i\n", param->value, param->line);
|
"15 at line %i\n", param->value, param->line);
|
||||||
}
|
}
|
||||||
|
|
||||||
replay_gain_preamp = pow(10, f / 20.0);
|
replay_gain_preamp = pow(10, f / 20.0);
|
||||||
|
@ -116,13 +116,13 @@ void replay_gain_global_init(void)
|
||||||
float f = strtod(param->value, &test);
|
float f = strtod(param->value, &test);
|
||||||
|
|
||||||
if (*test != '\0') {
|
if (*test != '\0') {
|
||||||
MPD_ERROR("Replaygain missing preamp \"%s\" is not a number at "
|
FormatFatalError("Replaygain missing preamp \"%s\" is not a number at "
|
||||||
"line %i\n", param->value, param->line);
|
"line %i\n", param->value, param->line);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f < -15 || f > 15) {
|
if (f < -15 || f > 15) {
|
||||||
MPD_ERROR("Replaygain missing preamp \"%s\" is not between -15 and"
|
FormatFatalError("Replaygain missing preamp \"%s\" is not between -15 and"
|
||||||
"15 at line %i\n", param->value, param->line);
|
"15 at line %i\n", param->value, param->line);
|
||||||
}
|
}
|
||||||
|
|
||||||
replay_gain_missing_preamp = pow(10, f / 20.0);
|
replay_gain_missing_preamp = pow(10, f / 20.0);
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include "ConfigGlobal.hxx"
|
#include "ConfigGlobal.hxx"
|
||||||
#include "ConfigOption.hxx"
|
#include "ConfigOption.hxx"
|
||||||
#include "Song.hxx"
|
#include "Song.hxx"
|
||||||
#include "mpd_error.h"
|
#include "system/FatalError.hxx"
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -119,8 +119,8 @@ void tag_lib_init(void)
|
||||||
|
|
||||||
type = tag_name_parse_i(c);
|
type = tag_name_parse_i(c);
|
||||||
if (type == TAG_NUM_OF_ITEM_TYPES)
|
if (type == TAG_NUM_OF_ITEM_TYPES)
|
||||||
MPD_ERROR("error parsing metadata item \"%s\"",
|
FormatFatalError("error parsing metadata item \"%s\"",
|
||||||
c);
|
c);
|
||||||
|
|
||||||
ignore_tag_items[type] = false;
|
ignore_tag_items[type] = false;
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|
||||||
#include "gcc.h"
|
#include "gcc.h"
|
||||||
#include "mpd_error.h"
|
|
||||||
#include "GlobalEvents.hxx"
|
#include "GlobalEvents.hxx"
|
||||||
|
#include "system/FatalError.hxx"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
@ -92,8 +92,8 @@ service_main(gcc_unused DWORD argc, gcc_unused CHAR *argv[])
|
||||||
if (service_handle == 0) {
|
if (service_handle == 0) {
|
||||||
error_code = GetLastError();
|
error_code = GetLastError();
|
||||||
error_message = g_win32_error_message(error_code);
|
error_message = g_win32_error_message(error_code);
|
||||||
MPD_ERROR("RegisterServiceCtrlHandlerEx() failed: %s",
|
FormatFatalError("RegisterServiceCtrlHandlerEx() failed: %s",
|
||||||
error_message);
|
error_message);
|
||||||
}
|
}
|
||||||
|
|
||||||
service_notify_status(SERVICE_START_PENDING);
|
service_notify_status(SERVICE_START_PENDING);
|
||||||
|
@ -150,7 +150,8 @@ int win32_main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
error_message = g_win32_error_message(error_code);
|
error_message = g_win32_error_message(error_code);
|
||||||
MPD_ERROR("StartServiceCtrlDispatcher() failed: %s", error_message);
|
FormatFatalError("StartServiceCtrlDispatcher() failed: %s",
|
||||||
|
error_message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void win32_app_started()
|
void win32_app_started()
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include "ZeroconfInternal.hxx"
|
#include "ZeroconfInternal.hxx"
|
||||||
#include "Listen.hxx"
|
#include "Listen.hxx"
|
||||||
#include "event/Loop.hxx"
|
#include "event/Loop.hxx"
|
||||||
#include "mpd_error.h"
|
#include "system/FatalError.hxx"
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ AvahiInit(EventLoop &loop, const char *serviceName)
|
||||||
g_debug("Initializing interface");
|
g_debug("Initializing interface");
|
||||||
|
|
||||||
if (!avahi_is_valid_service_name(serviceName))
|
if (!avahi_is_valid_service_name(serviceName))
|
||||||
MPD_ERROR("Invalid zeroconf_name \"%s\"", serviceName);
|
FormatFatalError("Invalid zeroconf_name \"%s\"", serviceName);
|
||||||
|
|
||||||
avahiName = avahi_strdup(serviceName);
|
avahiName = avahi_strdup(serviceName);
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,8 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "MikmodDecoderPlugin.hxx"
|
#include "MikmodDecoderPlugin.hxx"
|
||||||
#include "DecoderAPI.hxx"
|
#include "DecoderAPI.hxx"
|
||||||
#include "mpd_error.h"
|
|
||||||
#include "TagHandler.hxx"
|
#include "TagHandler.hxx"
|
||||||
|
#include "system/FatalError.hxx"
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <mikmod.h>
|
#include <mikmod.h>
|
||||||
|
@ -112,8 +112,8 @@ mikmod_decoder_init(const config_param ¶m)
|
||||||
|
|
||||||
mikmod_sample_rate = param.GetBlockValue("sample_rate", 44100u);
|
mikmod_sample_rate = param.GetBlockValue("sample_rate", 44100u);
|
||||||
if (!audio_valid_sample_rate(mikmod_sample_rate))
|
if (!audio_valid_sample_rate(mikmod_sample_rate))
|
||||||
MPD_ERROR("Invalid sample rate in line %d: %u",
|
FormatFatalError("Invalid sample rate in line %d: %u",
|
||||||
param.line, mikmod_sample_rate);
|
param.line, mikmod_sample_rate);
|
||||||
|
|
||||||
md_device = 0;
|
md_device = 0;
|
||||||
md_reverb = 0;
|
md_reverb = 0;
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "fs/Path.hxx"
|
#include "fs/Path.hxx"
|
||||||
#include "ConfigGlobal.hxx"
|
#include "ConfigGlobal.hxx"
|
||||||
#include "mpd_error.h"
|
#include "system/FatalError.hxx"
|
||||||
#include "gcc.h"
|
#include "gcc.h"
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
@ -105,7 +105,7 @@ SetFSCharset(const char *charset)
|
||||||
assert(charset != NULL);
|
assert(charset != NULL);
|
||||||
|
|
||||||
if (!IsSupportedCharset(charset))
|
if (!IsSupportedCharset(charset))
|
||||||
MPD_ERROR("invalid filesystem charset: %s", charset);
|
FormatFatalError("invalid filesystem charset: %s", charset);
|
||||||
|
|
||||||
fs_charset = charset;
|
fs_charset = charset;
|
||||||
|
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2003-2011 The Music Player Daemon Project
|
|
||||||
* http://www.musicpd.org
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef MPD_ERROR_H
|
|
||||||
#define MPD_ERROR_H
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
/* This macro is used as an intermediate step to a proper error handling
|
|
||||||
* using #Error in mpd. It is used for unrecoverable error conditions
|
|
||||||
* and exits immediately. The long-term goal is to replace this macro by
|
|
||||||
* proper error handling. */
|
|
||||||
|
|
||||||
#define MPD_ERROR(...) \
|
|
||||||
do { \
|
|
||||||
g_critical(__VA_ARGS__); \
|
|
||||||
exit(EXIT_FAILURE); \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include "ConfigError.hxx"
|
#include "ConfigError.hxx"
|
||||||
#include "util/Error.hxx"
|
#include "util/Error.hxx"
|
||||||
#include "util/Domain.hxx"
|
#include "util/Domain.hxx"
|
||||||
#include "mpd_error.h"
|
#include "system/FatalError.hxx"
|
||||||
|
|
||||||
#include <shout/shout.h>
|
#include <shout/shout.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
@ -102,8 +102,8 @@ require_block_string(const config_param ¶m, const char *name)
|
||||||
{
|
{
|
||||||
const char *value = param.GetBlockValue(name);
|
const char *value = param.GetBlockValue(name);
|
||||||
if (value == nullptr)
|
if (value == nullptr)
|
||||||
MPD_ERROR("no \"%s\" defined for shout device defined at line " \
|
FormatFatalError("no \"%s\" defined for shout device defined "
|
||||||
"%i\n", name, param.line);
|
"at line %u\n", name, param.line);
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,12 @@ FatalError(const Error &error)
|
||||||
FatalError(error.GetMessage());
|
FatalError(error.GetMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FatalError(const char *msg, const Error &error)
|
||||||
|
{
|
||||||
|
FormatFatalError("%s: %s", msg, error.GetMessage());
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FatalError(GError *error)
|
FatalError(GError *error)
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,6 +41,10 @@ gcc_noreturn
|
||||||
void
|
void
|
||||||
FatalError(const Error &error);
|
FatalError(const Error &error);
|
||||||
|
|
||||||
|
gcc_noreturn
|
||||||
|
void
|
||||||
|
FatalError(const char *msg, const Error &error);
|
||||||
|
|
||||||
gcc_noreturn
|
gcc_noreturn
|
||||||
void
|
void
|
||||||
FatalError(GError *error);
|
FatalError(GError *error);
|
||||||
|
|
Loading…
Reference in New Issue