From 35f0e8491b05a67898d874764be11f11f0267936 Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Fri, 28 Jul 2023 11:25:24 +0100 Subject: [PATCH] [iso] Complement error message on failure to open Add more information to the exception that is thrown when QFile fails to open, in the hope that we can gain some insight into why this keeps failing in CI. --- src/iso/CMakeLists.txt | 1 + src/iso/cloud_init_iso.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/iso/CMakeLists.txt b/src/iso/CMakeLists.txt index d874b18600..7961c6cdde 100644 --- a/src/iso/CMakeLists.txt +++ b/src/iso/CMakeLists.txt @@ -18,4 +18,5 @@ add_library(iso STATIC cloud_init_iso.cpp) target_link_libraries(iso + fmt Qt6::Core) diff --git a/src/iso/cloud_init_iso.cpp b/src/iso/cloud_init_iso.cpp index 9583d77c09..8323b20057 100644 --- a/src/iso/cloud_init_iso.cpp +++ b/src/iso/cloud_init_iso.cpp @@ -18,6 +18,7 @@ */ #include +#include #include @@ -389,7 +390,8 @@ void mp::CloudInitIso::write_to(const Path& path) { QFile f{path}; if (!f.open(QIODevice::WriteOnly)) - throw std::runtime_error{"failed to open file for writing during cloud-init generation"}; + throw std::runtime_error{fmt::format( + "Failed to open file for writing during cloud-init generation: {}; path: {}", f.errorString(), path)}; const uint32_t num_reserved_bytes = 32768u; const uint32_t num_reserved_blocks = num_blocks(num_reserved_bytes);