From 0abaa3ecc5d17f3578b8d1b34a63fdcca5d85a00 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 26 Jun 2019 22:38:40 +0200 Subject: [PATCH] decoder/wildmidi: throw PluginUnavailable if config file does not exist This makes the configuration error more visible, possibly addressing one part of https://github.com/MusicPlayerDaemon/MPD/issues/589 --- src/decoder/plugins/WildmidiDecoderPlugin.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/decoder/plugins/WildmidiDecoderPlugin.cxx b/src/decoder/plugins/WildmidiDecoderPlugin.cxx index 68a72a30a..37bb026e2 100644 --- a/src/decoder/plugins/WildmidiDecoderPlugin.cxx +++ b/src/decoder/plugins/WildmidiDecoderPlugin.cxx @@ -21,10 +21,12 @@ #include "../DecoderAPI.hxx" #include "tag/Handler.hxx" #include "util/Domain.hxx" +#include "util/StringFormat.hxx" #include "fs/AllocatedPath.hxx" #include "fs/FileSystem.hxx" #include "fs/Path.hxx" #include "Log.hxx" +#include "PluginUnavailable.hxx" extern "C" { #include @@ -43,10 +45,8 @@ wildmidi_init(const ConfigBlock &block) if (!FileExists(path)) { const auto utf8 = path.ToUTF8(); - FormatDebug(wildmidi_domain, - "configuration file does not exist: %s", - utf8.c_str()); - return false; + throw PluginUnavailable(StringFormat<1024>("configuration file does not exist: %s", + utf8.c_str())); } return WildMidi_Init(path.c_str(), wildmidi_audio_format.sample_rate,