input/smbclient: use std::throw_with_nested() to construct PluginUnavailable

Preserve the original exception.
This commit is contained in:
Max Kellermann 2019-03-29 17:32:23 +01:00
parent 2e9f3d8b9f
commit fb7daa0d05

View File

@ -28,8 +28,6 @@
#include <libsmbclient.h>
#include <stdexcept>
class SmbclientInputStream final : public InputStream {
SMBCCTX *ctx;
int fd;
@ -72,9 +70,8 @@ input_smbclient_init(EventLoop &, const ConfigBlock &)
{
try {
SmbclientInit();
} catch (const std::runtime_error &e) {
// TODO: use std::throw_with_nested()?
throw PluginUnavailable(e.what());
} catch (...) {
std::throw_with_nested(PluginUnavailable("libsmbclient initialization failed"));
}
// TODO: create one global SMBCCTX here?