From fb7daa0d059110297b975a830043ec700e510c0c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 29 Mar 2019 17:32:23 +0100 Subject: [PATCH] input/smbclient: use std::throw_with_nested() to construct PluginUnavailable Preserve the original exception. --- src/input/plugins/SmbclientInputPlugin.cxx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/input/plugins/SmbclientInputPlugin.cxx b/src/input/plugins/SmbclientInputPlugin.cxx index 4469dbab5..b4b0785f8 100644 --- a/src/input/plugins/SmbclientInputPlugin.cxx +++ b/src/input/plugins/SmbclientInputPlugin.cxx @@ -28,8 +28,6 @@ #include -#include - 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?