Commit a1e9678b authored by Max Kellermann's avatar Max Kellermann

decoder/Thread: std::throw_with_nested() to wrap caught exception

parent be5d629c
...@@ -361,25 +361,14 @@ try { ...@@ -361,25 +361,14 @@ try {
: decoder_run_stream(decoder, real_uri); : decoder_run_stream(decoder, real_uri);
} catch (StopDecoder) { } catch (StopDecoder) {
return true; return true;
} catch (const std::runtime_error &e) { } catch (...) {
/* copy the exception to decoder.error */
if (decoder.error.IsDefined()) {
/* decoder.error already set, now we have a second
one; only log the second one */
LogError(e);
return false;
}
const char *error_uri = real_uri; const char *error_uri = real_uri;
const std::string allocated = uri_remove_auth(error_uri); const std::string allocated = uri_remove_auth(error_uri);
if (!allocated.empty()) if (!allocated.empty())
error_uri = allocated.c_str(); error_uri = allocated.c_str();
decoder.error.Format(decoder_domain, std::throw_with_nested(FormatRuntimeError("Failed to decode %s",
"Failed to decode %s: %s", error_uri));
error_uri, e.what());
return false;
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment