On Tue, 14 Feb 2012 09:13:16 +0100
Jiri Suchomel
Dne Po 13. února 2012 19:19:56, Josef Reidinger napsal(a):
Hi YaST hackers, there is problem with exceptions from ruby modules. Now if risen, yast crash. I found this behavior quite annoying and it should be improved. I can do it, question is what is correct behavior. Does anyone have suggestion? In yast++ we have now error variable and catch exceptions. So I can in ruby bindings ( and only in bindings so ruby code is not affected ) extend class by method that return message of last exception. So you can run code as if (Module::run == nil) y2error ("Problem with run %1",Module.yast_error);
I think this is basically only option from YaST side; catch exception in ruby- bindings layer and save some error exception message (just do not call it 'yast_error', better, exception_message or last_error). Who would need to set that variable? YLib? Or could it be set by ruby-bindings from the exception message it catches?
ruby-bindings should set it. YLib shouls behave like modern library and use exceptions. Name is not important it just need to be unique ( if there is existing ruby module with such name so we don't break it.
I welcome any other suggestions or comments. Also it would be nice to have uniform way....how python bindings solve such problem?
I do not think it is solved in python-bindings. I've just tested: when exception is raised, YaST logs an error. But it does not crash
It can be also option, but it prevent to have user friendly modules. Josef
Jiri
-- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org