From 85e82e3d4d7c8fa9947768c1819eeb4aa963c1bd Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 26 Jun 2019 22:01:45 +0200 Subject: [PATCH] decoder/List: annotate exceptions thrown by DecoderPlugin::Init() --- src/decoder/DecoderList.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/decoder/DecoderList.cxx b/src/decoder/DecoderList.cxx index 286136826..510a45e20 100644 --- a/src/decoder/DecoderList.cxx +++ b/src/decoder/DecoderList.cxx @@ -45,6 +45,7 @@ #include "plugins/FluidsynthDecoderPlugin.hxx" #include "plugins/SidplayDecoderPlugin.hxx" #include "util/Macros.hxx" +#include "util/RuntimeError.hxx" #include @@ -147,8 +148,13 @@ decoder_plugin_init_all(const ConfigData &config) if (param != nullptr) param->SetUsed(); - if (plugin.Init(*param)) - decoder_plugins_enabled[i] = true; + try { + if (plugin.Init(*param)) + decoder_plugins_enabled[i] = true; + } catch (...) { + std::throw_with_nested(FormatRuntimeError("Failed to initialize decoder plugin '%s'", + plugin.name)); + } } }