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 "thread/Mutex.hxx"
|
||||||
#include "input/InputStream.hxx"
|
#include "input/InputStream.hxx"
|
||||||
#include "input/LocalOpen.hxx"
|
#include "input/LocalOpen.hxx"
|
||||||
#include "Log.hxx"
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ScanGenericTags(InputStream &is, TagHandler &handler) noexcept
|
ScanGenericTags(InputStream &is, TagHandler &handler)
|
||||||
{
|
{
|
||||||
if (tag_ape_scan2(is, handler))
|
if (tag_ape_scan2(is, handler))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
#ifdef ENABLE_ID3TAG
|
#ifdef ENABLE_ID3TAG
|
||||||
try {
|
is.LockRewind();
|
||||||
is.LockRewind();
|
|
||||||
} catch (...) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return tag_id3_scan(is, handler);
|
return tag_id3_scan(is, handler);
|
||||||
#else
|
#else
|
||||||
|
@ -49,13 +44,10 @@ ScanGenericTags(InputStream &is, TagHandler &handler) noexcept
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ScanGenericTags(Path path, TagHandler &handler) noexcept
|
ScanGenericTags(Path path, TagHandler &handler)
|
||||||
try {
|
{
|
||||||
Mutex mutex;
|
Mutex mutex;
|
||||||
|
|
||||||
auto is = OpenLocalInputStream(path, mutex);
|
auto is = OpenLocalInputStream(path, mutex);
|
||||||
return ScanGenericTags(*is, handler);
|
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
|
* Attempts to scan APE or ID3 tags from the specified stream. The
|
||||||
* stream does not need to be rewound.
|
* stream does not need to be rewound.
|
||||||
|
*
|
||||||
|
* Throws on error.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
ScanGenericTags(InputStream &is, TagHandler &handler) noexcept;
|
ScanGenericTags(InputStream &is, TagHandler &handler);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempts to scan APE or ID3 tags from the specified file.
|
* Attempts to scan APE or ID3 tags from the specified file.
|
||||||
|
*
|
||||||
|
* Throws on error.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
ScanGenericTags(Path path, TagHandler &handler) noexcept;
|
ScanGenericTags(Path path, TagHandler &handler);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue