[libcxx-commits] [PATCH] D125245: [libc++abi] Reword uncaught exception termination message

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon May 9 10:35:32 PDT 2022


ldionne created this revision.
Herald added a project: All.
ldionne requested review of this revision.
Herald added a project: libc++abi.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++abi.

When we terminate due to an exception being uncaught, libc++abi prints
a message saying "terminating with uncaught exception [...]". This patch
changes that to say "terminating due to uncaught exception [...]" instead,
which is a bit clearer. Indeed, I've seen some people being confused and
thinking that libc++abi was the component throwing the exception.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125245

Files:
  libcxxabi/src/cxa_default_handlers.cpp


Index: libcxxabi/src/cxa_default_handlers.cpp
===================================================================
--- libcxxabi/src/cxa_default_handlers.cpp
+++ libcxxabi/src/cxa_default_handlers.cpp
@@ -63,17 +63,17 @@
                 {
                     // Include the what() message from the exception
                     const std::exception* e = static_cast<const std::exception*>(thrown_object);
-                    abort_message("terminating with %s exception of type %s: %s",
+                    abort_message("terminating due to %s exception of type %s: %s",
                                   cause, name, e->what());
                 }
                 else
-                    // Else just note that we're terminating with an exception
-                    abort_message("terminating with %s exception of type %s",
+                    // Else just note that we're terminating due to an exception
+                    abort_message("terminating due to %s exception of type %s",
                                    cause, name);
             }
             else
-                // Else we're terminating with a foreign exception
-                abort_message("terminating with %s foreign exception", cause);
+                // Else we're terminating due to a foreign exception
+                abort_message("terminating due to %s foreign exception", cause);
         }
     }
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125245.428129.patch
Type: text/x-patch
Size: 1407 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220509/32354e29/attachment.bin>


More information about the libcxx-commits mailing list