]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Nicely format exception texts.
authorWolfgang Bangerth <bangerth@colostate.edu>
Mon, 25 Jan 2021 21:58:36 +0000 (14:58 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Mon, 25 Jan 2021 21:58:36 +0000 (14:58 -0700)
source/base/exceptions.cc

index e3d1e2bb5ae1d958e95848ea6860216e7fc551fe..336abc2dbf971908ee090cc54e6913738f703e1b 100644 (file)
@@ -321,10 +321,25 @@ ExceptionBase::generate_message() const
                 << "--------------------------------------------------------"
                 << std::endl;
 
-      // print out general data
+      // Print out general data
       print_exc_data(converter);
-      // print out exception specific data
-      print_info(converter);
+
+      // Print out exception specific data. Put this into another stringstream
+      // object for now so that we can break long lines and print them in a
+      // more easily read way
+      {
+        std::ostringstream message;
+        print_info(message);
+
+        const auto message_in_lines =
+          Utilities::break_text_into_lines(message.str(), 70);
+
+        // Put the message into the stream that will be output.
+        for (const auto &line : message_in_lines)
+          converter << "    " << line << '\n';
+      }
+
+
       print_stack_trace(converter);
 
       if (!deal_II_exceptions::internals::get_additional_assert_output()

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.