Problem with standard regex
Yuriy Skalko
yuriy.skalko at gmail.com
Mon Jan 4 10:23:47 UTC 2021
>> 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
-------------- next part --------------
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;
}
More information about the lyx-devel
mailing list