summaryrefslogtreecommitdiff
path: root/src/SongSave.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2016-10-29 09:45:34 +0200
committerMax Kellermann <max@musicpd.org>2016-10-29 09:45:34 +0200
commit90a14e14f457e7ec34dd8ff3dcfe710e2dd93208 (patch)
treed12ec940506c2a51fee437e5499ea248a99b7650 /src/SongSave.cxx
parentdea46e8d5a714a483aee8e14775eb8b3a69aa4ad (diff)
db/simple/Save: migrate from class Error to C++ exceptions
Diffstat (limited to 'src/SongSave.cxx')
-rw-r--r--src/SongSave.cxx16
1 files changed, 4 insertions, 12 deletions
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 <string.h>
#include <stdlib.h>
@@ -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);
}
}