On Donnerstag, 4. September 2008, Ladislav Slezak wrote:
My question is why is the failed check considered as a fatal error? Isn't it rather a minor problem? Would be an y2warning message enough instead of aborting the module?
It doesn't abort the module; it makes UI::OpenDialog() fail. You could easily
catch that in YCP code (but it's not done anywhere in production code):
http://svn.opensuse.org/svn/yast/trunk/ycp-ui-bindings/examples/ButtonBox2.y...
void showDialog( term buttonBox )
{
boolean success = (boolean)
UI::OpenDialog(
`VBox(
`HVCenter( `Label( "Hello, World!" ) ),
buttonBox
)
);
// Most YCP developers never use the return value of UI::OpenDialog().
// Many of them probably don't even know that it has a return value.
//
// Used properly, that return value can be used to recover from error
// situations that would otherwise abort the program - like in this
//case.
if ( success )
{
UI::UserInput();
UI::CloseDialog();
}
}
Past experience shows that y2warning() calls are generally ignored, so they
are pretty useless.
CU
--
Stefan Hundhammer