Richard Heck wrote:
Abdelrazak Younes wrote:
Richard Heck wrote:
There's reason to want to do the test. The idea is to see if the previous call to string2params issued an error. But this test can't work, because the constructor call sets the command name, and the string2params call, though it clears the parameters before it does anything else, does not clear THAT. Anyway, it's obvious that this way of doing the test appeals to magic. So the question is how best to do it.
I see that InsetCommandParams::read() is throwing warning exception is there's a parsing error. This can happen for example when a user uses wrong options in the minibuffer for the given LFUN. So it's a good idea to catch them and your patch is right in this sense. But I guess this is something the user want to know about instead of silently do nothing. So you'd better launch a warning dialog to inform the user.
Does the warning dialog not get shown if the exception is caught? I thought that might be the case.

No, see other codes that catch this kind of exception:

int LyX::exec(int & argc, char * argv[])
{
        // Here we need to parse the command line. At least
        // we need to parse for "-dbg" and "-help"
        easyParse(argc, argv);

        try { support::init_package(to_utf8(from_local8bit(argv[0])),
                              cl_system_support, cl_user_support,
                              support::top_build_dir_is_one_level_up);
        } catch (support::ExceptionMessage const & message) {
                if (message.type_ == support::ErrorException) {
                        Alert::error(message.title_, message.details_);
                        exit(1);
                } else if (message.type_ == support::WarningException) {
                        Alert::warning(message.title_, message.details_);
                }
        }

Reply via email to