archive/ArchiveLookup: throw on error

This commit is contained in:
Max Kellermann
2019-05-31 18:52:11 +02:00
parent 2f83ed90d0
commit fa13648f2c
4 changed files with 19 additions and 10 deletions

View File

@@ -45,9 +45,15 @@ OpenArchiveInputStream(Path path, Mutex &mutex)
// archive_lookup will modify pname when true is returned
const char *archive, *filename, *suffix;
if (!archive_lookup(pname, &archive, &filename, &suffix)) {
FormatDebug(archive_domain,
"not an archive, lookup %s failed", pname);
try {
if (!archive_lookup(pname, &archive, &filename, &suffix)) {
FormatDebug(archive_domain,
"not an archive, lookup %s failed", pname);
return nullptr;
}
} catch (...) {
LogFormat(LogLevel::DEBUG, std::current_exception(),
"not an archive, lookup %s failed", pname);
return nullptr;
}