From 2a47379ab57a606cda40a167bfd27d30c6f14642 Mon Sep 17 00:00:00 2001 From: Sebastian Sumpf Date: Tue, 12 Apr 2022 10:48:18 +0200 Subject: [PATCH] vbox6: display cause of error on failed 'initFromSettings' Use 'ErrorInfoKeeper' to retrieve current error from XPCOM service and log message. fixes #4473 --- repos/ports/src/virtualbox6/main.cc | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/repos/ports/src/virtualbox6/main.cc b/repos/ports/src/virtualbox6/main.cc index 77c0f0e3c5..1dd498ad2e 100644 --- a/repos/ports/src/virtualbox6/main.cc +++ b/repos/ports/src/virtualbox6/main.cc @@ -149,10 +149,19 @@ struct Main : Event_handler attempt([&] () { return createObject(); }, "failed to create Machine object"); - attempt([&] () { return (*this)->initFromSettings(virtualbox, - vbox_file_path.utf8, - nullptr); }, - "failed to init machine from settings"); + HRESULT const rc = (*this)->initFromSettings(virtualbox, + vbox_file_path.utf8, + nullptr); + if (FAILED(rc)) { + Genode::error("failed to init machine from settings"); + /* + * Use keeper to retrieve current error message + */ + ErrorInfoKeeper eik; + Bstr const &text = eik.getText(); + Genode::log(Utf8Str(text.raw()).c_str()); + throw Fatal(); + } /* * Add the machine to the VirtualBox::allMachines list