From 6f1d5105ee61b1304948c41047c9c63de4ef2fbb Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Tue, 21 May 2019 23:07:49 +0200
Subject: [PATCH] TagStream: allow tag_stream_scan() to throw

---
 src/TagStream.cxx | 12 ++++--------
 src/TagStream.hxx | 10 ++++++++--
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/TagStream.cxx b/src/TagStream.cxx
index 0cedc72cc..bed542a10 100644
--- a/src/TagStream.cxx
+++ b/src/TagStream.cxx
@@ -73,14 +73,12 @@ tag_stream_scan(InputStream &is, TagHandler &handler) noexcept
 }
 
 bool
-tag_stream_scan(const char *uri, TagHandler &handler) noexcept
-try {
+tag_stream_scan(const char *uri, TagHandler &handler)
+{
 	Mutex mutex;
 
 	auto is = InputStream::OpenReady(uri, mutex);
 	return tag_stream_scan(*is, handler);
-} catch (const std::exception &e) {
-	return false;
 }
 
 bool
@@ -102,12 +100,10 @@ tag_stream_scan(InputStream &is, TagBuilder &builder,
 
 bool
 tag_stream_scan(const char *uri, TagBuilder &builder,
-		AudioFormat *audio_format) noexcept
-try {
+		AudioFormat *audio_format)
+{
 	Mutex mutex;
 
 	auto is = InputStream::OpenReady(uri, mutex);
 	return tag_stream_scan(*is, builder, audio_format);
-} catch (const std::exception &e) {
-	return false;
 }
diff --git a/src/TagStream.hxx b/src/TagStream.hxx
index 33e513f16..999c12765 100644
--- a/src/TagStream.hxx
+++ b/src/TagStream.hxx
@@ -35,8 +35,11 @@ class TagBuilder;
 bool
 tag_stream_scan(InputStream &is, TagHandler &handler) noexcept;
 
+/**
+ * Throws on error.
+ */
 bool
-tag_stream_scan(const char *uri, TagHandler &handler) noexcept;
+tag_stream_scan(const char *uri, TagHandler &handler);
 
 /**
  * Scan the tags of an #InputStream.  Invokes matching decoder
@@ -50,8 +53,11 @@ bool
 tag_stream_scan(InputStream &is, TagBuilder &builder,
 		AudioFormat *audio_format=nullptr) noexcept;
 
+/**
+ * Throws on error.
+ */
 bool
 tag_stream_scan(const char *uri, TagBuilder &builder,
-		AudioFormat *audio_format=nullptr) noexcept;
+		AudioFormat *audio_format=nullptr);
 
 #endif