From 90a14e14f457e7ec34dd8ff3dcfe710e2dd93208 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 29 Oct 2016 09:45:34 +0200 Subject: db/simple/Save: migrate from class Error to C++ exceptions --- src/SongSave.cxx | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'src/SongSave.cxx') diff --git a/src/SongSave.cxx b/src/SongSave.cxx index d20ad4af1..265b3c286 100644 --- a/src/SongSave.cxx +++ b/src/SongSave.cxx @@ -27,8 +27,7 @@ #include "tag/Tag.hxx" #include "tag/TagBuilder.hxx" #include "util/StringUtil.hxx" -#include "util/Error.hxx" -#include "util/Domain.hxx" +#include "util/RuntimeError.hxx" #include #include @@ -36,8 +35,6 @@ #define SONG_MTIME "mtime" #define SONG_END "song_end" -static constexpr Domain song_save_domain("song_save"); - static void range_save(BufferedOutputStream &os, unsigned start_ms, unsigned end_ms) { @@ -74,8 +71,7 @@ song_save(BufferedOutputStream &os, const DetachedSong &song) } DetachedSong * -song_load(TextFile &file, const char *uri, - Error &error) +song_load(TextFile &file, const char *uri) { DetachedSong *song = new DetachedSong(uri); @@ -88,9 +84,7 @@ song_load(TextFile &file, const char *uri, if (colon == nullptr || colon == line) { delete song; - error.Format(song_save_domain, - "unknown line in db: %s", line); - return nullptr; + throw FormatRuntimeError("unknown line in db: %s", line); } *colon++ = 0; @@ -118,9 +112,7 @@ song_load(TextFile &file, const char *uri, } else { delete song; - error.Format(song_save_domain, - "unknown line in db: %s", line); - return nullptr; + throw FormatRuntimeError("unknown line in db: %s", line); } } -- cgit v1.2.3