decoder/Internal: convert error from Error to std::exception_ptr

This commit is contained in:
Max Kellermann
2016-09-08 20:31:06 +02:00
parent 25f7360264
commit 845901ab01
3 changed files with 9 additions and 8 deletions

View File

@@ -211,7 +211,7 @@ decoder_run_stream_plugin(Decoder &decoder, InputStream &is,
if (!decoder_check_plugin(plugin, is, suffix))
return false;
decoder.error.Clear();
decoder.error = std::exception_ptr();
tried_r = true;
return decoder_stream_decode(plugin, decoder, is);
@@ -300,7 +300,7 @@ TryDecoderFile(Decoder &decoder, Path path_fs, const char *suffix,
if (!plugin.SupportsSuffix(suffix))
return false;
decoder.error.Clear();
decoder.error = std::exception_ptr();
DecoderControl &dc = decoder.dc;
@@ -398,10 +398,10 @@ decoder_run_song(DecoderControl &dc,
}
if (decoder.error.IsDefined()) {
if (decoder.error) {
/* copy the Error from struct Decoder to
DecoderControl */
throw std::move(decoder.error);
std::rethrow_exception(decoder.error);
} else if (success)
dc.state = DecoderState::STOP;
else {