lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] [PATCH] Add undisplayable_exception


From: Vadim Zeitlin
Subject: Re: [lmi] [PATCH] Add undisplayable_exception
Date: Sat, 11 Oct 2014 14:02:55 +0200

On Sat, 11 Oct 2014 00:12:05 +0000 Greg Chicares <address@hidden> wrote:

GC> On 2014-10-09 14:40Z, Vadim Zeitlin wrote:
GC> [...]
GC> >  So the best I can do is the patch below, please let me know if you see a
GC> > way of improving it, i.e. minimizing the changes to the production version
GC> > even further.
GC> 
GC> It's hard to explain how utterly averse to abrupt termination our users are,
GC> but that's reason enough to do the following, in addition to everything else
GC> we've already done for safety--unless you see a reason not to;

 No, I don't, this seems perfectly fine to me.

GC> but AFAICT the 'wx_test' program doesn't exercise 'main_wx.cpp', but
GC> completely replaces it, so this should be harmless, no?

 Yes, exactly.

GC> Index: main_wx.cpp
GC> ===================================================================
GC> --- main_wx.cpp     (revision 5978)
GC> +++ main_wx.cpp     (working copy)
GC> @@ -36,6 +36,7 @@
GC>  #   pragma hdrstop
GC>  #endif
GC> 
GC> +#include "alert.hpp"                    // safely_show_message()
GC>  #include "fenv_lmi.hpp"
GC>  #include "force_linking.hpp"
GC>  #include "handle_exceptions.hpp"
GC> @@ -98,6 +99,11 @@
GC>          result = wxEntry(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
GC>  #endif // LMI_MSW defined.
GC>          }
GC> +    catch(wx_test_exception const&)
GC> +        {
GC> +        result = EXIT_FAILURE;
GC> +        safely_show_message("Logic error: caught 'wx_test_exception'.");
GC> +        }
GC>      catch(...)
GC>          {
GC>          report_exception();

 However I wonder if a more general fix might be even better: while it would
work exactly in the same way as above patch right now, it would also remain
safe even if more exceptions escape report_exception() in the future for
any reason:

-- >8 --
--- a/main_wx.cpp
+++ b/main_wx.cpp
@@ -100,7 +100,14 @@ int main(int argc, char* argv[])
         }
     catch(...)
         {
-        report_exception();
+        try
+            {
+            report_exception();
+            }
+        catch(...)
+            {
+            safely_show_message("Logic error: exception not reported 
correctly.");
+            }
         }

     fenv_validate();
-- >8 --

 I also like that this avoids mentioning wx_test_exception, which really
has nothing to do in the production code, completely.

 What do you think?
VZ

reply via email to

[Prev in Thread] Current Thread [Next in Thread]