From 4964ad7800b91468894681ac8f346ed4d1b574c0 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 10 Aug 2019 12:28:53 +0200 Subject: [PATCH] decoder/sidplay: sidplay_load_songlength_db() throws on error --- src/decoder/plugins/SidplayDecoderPlugin.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/decoder/plugins/SidplayDecoderPlugin.cxx b/src/decoder/plugins/SidplayDecoderPlugin.cxx index 7f2e067e7..cac939527 100644 --- a/src/decoder/plugins/SidplayDecoderPlugin.cxx +++ b/src/decoder/plugins/SidplayDecoderPlugin.cxx @@ -36,7 +36,7 @@ #include "util/AllocatedString.hxx" #include "util/CharUtil.hxx" #include "util/ByteOrder.hxx" -#include "util/Manual.hxx" +#include "util/RuntimeError.hxx" #include "Log.hxx" #ifdef HAVE_SIDPLAYFP @@ -101,8 +101,11 @@ static void loadRom(const Path rom_path, uint8_t *dump) } #endif +/** + * Throws on error. + */ static std::unique_ptr -sidplay_load_songlength_db(const Path path) noexcept +sidplay_load_songlength_db(const Path path) { auto db = std::make_unique(); #ifdef HAVE_SIDPLAYFP @@ -110,12 +113,9 @@ sidplay_load_songlength_db(const Path path) noexcept #else bool error = db->open(path.c_str()) < 0; #endif - if (error) { - FormatError(sidplay_domain, - "unable to read songlengths file %s: %s", - path.c_str(), db->error()); - return nullptr; - } + if (error) + throw FormatRuntimeError("unable to read songlengths file %s: %s", + path.c_str(), db->error()); return db; }