summaryrefslogtreecommitdiff
path: root/src/input/Error.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-07-06 19:12:46 +0200
committerMax Kellermann <max@musicpd.org>2018-07-06 19:16:01 +0200
commit30900b2fe2ac4b365ac5525519a26e61a2b61595 (patch)
tree08b2e2a63b9293ecfd91c64f260c35a4ef90613b /src/input/Error.cxx
parentfd7ae7ea4cf09c92c674d317fbd48ba2c6a02ac2 (diff)
input/Error: new library providing IsFileNotFound()
Diffstat (limited to 'src/input/Error.cxx')
-rw-r--r--src/input/Error.cxx36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/input/Error.cxx b/src/input/Error.cxx
new file mode 100644
index 000000000..04638a16e
--- /dev/null
+++ b/src/input/Error.cxx
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2003-2018 The Music Player Daemon Project
+ * http://www.musicpd.org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "config.h"
+#include "Error.hxx"
+#include "system/Error.hxx"
+
+bool
+IsFileNotFound(std::exception_ptr ep)
+{
+ try {
+ std::rethrow_exception(ep);
+ } catch (const std::system_error &e) {
+ return IsFileNotFound(e);
+ } catch (...) {
+ }
+
+ return false;
+}
+