vbox6: display cause of error on failed 'initFromSettings'

Use 'ErrorInfoKeeper' to retrieve current error from XPCOM service and
log message.

fixes #4473
This commit is contained in:
Sebastian Sumpf 2022-04-12 10:48:18 +02:00 committed by Christian Helmuth
parent f91ece78e0
commit 2a47379ab5

View File

@ -149,10 +149,19 @@ struct Main : Event_handler
attempt([&] () { return createObject(); },
"failed to create Machine object");
attempt([&] () { return (*this)->initFromSettings(virtualbox,
HRESULT const rc = (*this)->initFromSettings(virtualbox,
vbox_file_path.utf8,
nullptr); },
"failed to init machine from settings");
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