[libc++abi] Reword uncaught exception termination message
authorLouis Dionne <ldionne.2@gmail.com>
Mon, 9 May 2022 17:31:42 +0000 (13:31 -0400)
committerLouis Dionne <ldionne.2@gmail.com>
Tue, 10 May 2022 13:58:40 +0000 (09:58 -0400)
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.

Differential Revision: https://reviews.llvm.org/D125245

libcxxabi/src/cxa_default_handlers.cpp

index b6ce058..2c42f65 100644 (file)
@@ -63,17 +63,17 @@ static void demangling_terminate_handler()
                 {
                     // 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