tag/Generic: allow ScanGenericTags() to throw
Propagate the error to the caller instead of logging it.
This commit is contained in:
parent
92f7421715
commit
31b59a0db6
|
@ -24,23 +24,18 @@
|
|||
#include "thread/Mutex.hxx"
|
||||
#include "input/InputStream.hxx"
|
||||
#include "input/LocalOpen.hxx"
|
||||
#include "Log.hxx"
|
||||
#include "config.h"
|
||||
|
||||
#include <exception>
|
||||
|
||||
bool
|
||||
ScanGenericTags(InputStream &is, TagHandler &handler) noexcept
|
||||
ScanGenericTags(InputStream &is, TagHandler &handler)
|
||||
{
|
||||
if (tag_ape_scan2(is, handler))
|
||||
return true;
|
||||
|
||||
#ifdef ENABLE_ID3TAG
|
||||
try {
|
||||
is.LockRewind();
|
||||
} catch (...) {
|
||||
return false;
|
||||
}
|
||||
is.LockRewind();
|
||||
|
||||
return tag_id3_scan(is, handler);
|
||||
#else
|
||||
|
@ -49,13 +44,10 @@ ScanGenericTags(InputStream &is, TagHandler &handler) noexcept
|
|||
}
|
||||
|
||||
bool
|
||||
ScanGenericTags(Path path, TagHandler &handler) noexcept
|
||||
try {
|
||||
ScanGenericTags(Path path, TagHandler &handler)
|
||||
{
|
||||
Mutex mutex;
|
||||
|
||||
auto is = OpenLocalInputStream(path, mutex);
|
||||
return ScanGenericTags(*is, handler);
|
||||
} catch (...) {
|
||||
LogError(std::current_exception());
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -27,14 +27,18 @@ class Path;
|
|||
/**
|
||||
* Attempts to scan APE or ID3 tags from the specified stream. The
|
||||
* stream does not need to be rewound.
|
||||
*
|
||||
* Throws on error.
|
||||
*/
|
||||
bool
|
||||
ScanGenericTags(InputStream &is, TagHandler &handler) noexcept;
|
||||
ScanGenericTags(InputStream &is, TagHandler &handler);
|
||||
|
||||
/**
|
||||
* Attempts to scan APE or ID3 tags from the specified file.
|
||||
*
|
||||
* Throws on error.
|
||||
*/
|
||||
bool
|
||||
ScanGenericTags(Path path, TagHandler &handler) noexcept;
|
||||
ScanGenericTags(Path path, TagHandler &handler);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue