Further investigating shows the error in my own code (out of range access).
The following exception was catched in the try {} section in findAdv(), so the only
message was: "Invalid regular expression!". This was misleading.


Indeed that's not very helpful. Ideally it would say *why* it is not valid.

Maybe append additional exception message to that generic "Invalid..." message as in attached patch?


Yuriy
diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp
index c728af1cef..9bd77e739f 100644
--- a/src/lyxfind.cpp
+++ b/src/lyxfind.cpp
@@ -4115,9 +4115,9 @@ bool findAdv(BufferView * bv, FindAndReplaceOptions const 
& opt)
                        match_len = findForwardAdv(cur, matchAdv);
                else
                        match_len = findBackwardsAdv(cur, matchAdv);
-       } catch (...) {
+       } catch (exception & ex) {
                // This may only be raised by lyx::regex()
-               bv->message(_("Invalid regular expression!"));
+               bv->message(_("Invalid regular expression!") + ' ' + ex.what());
                return false;
        }
 
-- 
lyx-devel mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to