diff options
author | Max Kellermann <max@musicpd.org> | 2019-12-16 23:43:51 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2019-12-16 23:44:20 +0100 |
commit | 683d5848f414d1539686df2e0dc886d5252d34fe (patch) | |
tree | f082db3606a8afcd4413c88fc32e5394356c51ee /src/archive | |
parent | b4496272650f654113be00efddfda1deea8bb5a7 (diff) | |
parent | 5680a3a4b71661179b81e6434928d919d186c785 (diff) |
Merge tag 'v0.21.17'
release v0.21.17
Diffstat (limited to 'src/archive')
-rw-r--r-- | src/archive/plugins/ZzipArchivePlugin.cxx | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/archive/plugins/ZzipArchivePlugin.cxx b/src/archive/plugins/ZzipArchivePlugin.cxx index 2d5118160..e5b682635 100644 --- a/src/archive/plugins/ZzipArchivePlugin.cxx +++ b/src/archive/plugins/ZzipArchivePlugin.cxx @@ -27,6 +27,7 @@ #include "../ArchiveVisitor.hxx" #include "input/InputStream.hxx" #include "fs/Path.hxx" +#include "system/Error.hxx" #include "util/RuntimeError.hxx" #include <zzip/zzip.h> @@ -121,9 +122,19 @@ ZzipArchiveFile::OpenStream(const char *pathname, Mutex &mutex) { ZZIP_FILE *_file = zzip_file_open(dir->dir, pathname, 0); - if (_file == nullptr) - throw FormatRuntimeError("not found in the ZIP file: %s", - pathname); + if (_file == nullptr) { + const auto error = (zzip_error_t)zzip_error(dir->dir); + switch (error) { + case ZZIP_ENOENT: + throw FormatFileNotFound("Failed to open '%s' in ZIP file", + pathname); + + default: + throw FormatRuntimeError("Failed to open '%s' in ZIP file: %s", + pathname, + zzip_strerror(error)); + } + } return std::make_unique<ZzipInputStream>(dir, pathname, mutex, |