From 3a08e57516a7b7ad6f412e80671f68bff4322b9c Mon Sep 17 00:00:00 2001 From: Niklas Eiling Date: Mon, 23 Oct 2023 16:53:09 +0200 Subject: [PATCH] fix exception strings getting lost because of rethrowing them Signed-off-by: Niklas Eiling --- common/lib/kernel/vfio_container.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/common/lib/kernel/vfio_container.cpp b/common/lib/kernel/vfio_container.cpp index 224c92366..25ad9a143 100644 --- a/common/lib/kernel/vfio_container.cpp +++ b/common/lib/kernel/vfio_container.cpp @@ -203,9 +203,13 @@ std::shared_ptr Container::attachDevice(pci::Device &pdev) { try { pdev.rewriteBar(); } catch (std::exception &e) { + throw RuntimeError( - "BAR of device is in inconsistent state. Rewriting the BAR " - "failed. Please remove, rescan and reset the device and try again."); + e.what() + + std::string( + "\nBAR of device is in inconsistent state. Rewriting the BAR " + "failed. Please remove, rescan and reset the device and " + "try again.")); } // Get IOMMU group of device