]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make exception messages more consistent. 3205/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Tue, 4 Oct 2016 23:32:17 +0000 (17:32 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Wed, 5 Oct 2016 12:56:08 +0000 (06:56 -0600)
In particular, change the following two things: (i) Say 'Additional information'
instead of 'Additional Information' because the rest of the text is also
capitalized in the common way. (ii) Indent the actual (additional) error text
by four characters, just like the other additional pieces of information.

The result is that errors now look like this:

--------------------------------------------------------
An error occurred in line <710> of file </home/fac/f/bangerth/p/deal.II/1/install/examples/step-6/step-6.cc> in function
    int main()
The violated condition was:
    false
Additional information:
    abcdef

Stacktrace:
-----------
#0  ./step-6: main
--------------------------------------------------------

include/deal.II/base/exceptions.h
source/base/exceptions.cc

index c5298b6417f3300868697f5260f8b6ce9923d068..dab519cdc77df6ddf719a18d7e3fe5699aac42e5 100644 (file)
@@ -393,7 +393,7 @@ namespace deal_II_exceptions
     Exception (const std::string &msg = defaulttext) : arg (msg) {}       \
     virtual ~Exception () DEAL_II_NOEXCEPT {}                             \
     virtual void print_info (std::ostream &out) const {                   \
-      out << arg << std::endl;                                            \
+      out << "    " << arg << std::endl;                                  \
     }                                                                     \
   private:                                                                \
     const std::string arg;                                                \
@@ -411,7 +411,7 @@ namespace deal_II_exceptions
     Exception1 (const type1 a1) : arg1 (a1) {}                            \
     virtual ~Exception1 () DEAL_II_NOEXCEPT {}                            \
     virtual void print_info (std::ostream &out) const {                   \
-      out outsequence << std::endl;                                       \
+      out << "    " outsequence << std::endl;                             \
     }                                                                     \
   private:                                                                \
     const type1 arg1;                                                     \
@@ -431,7 +431,7 @@ namespace deal_II_exceptions
       arg1 (a1), arg2(a2) {}                                              \
     virtual ~Exception2 () DEAL_II_NOEXCEPT {}                            \
     virtual void print_info (std::ostream &out) const {                   \
-      out outsequence << std::endl;                                       \
+      out << "    " outsequence << std::endl;                             \
     }                                                                     \
   private:                                                                \
     const type1 arg1;                                                     \
@@ -452,7 +452,7 @@ namespace deal_II_exceptions
       arg1 (a1), arg2(a2), arg3(a3) {}                                    \
     virtual ~Exception3 () DEAL_II_NOEXCEPT {}                            \
     virtual void print_info (std::ostream &out) const {                   \
-      out outsequence << std::endl;                                       \
+      out << "    " outsequence << std::endl;                             \
     }                                                                     \
   private:                                                                \
     const type1 arg1;                                                     \
@@ -475,7 +475,7 @@ namespace deal_II_exceptions
       arg1 (a1), arg2(a2), arg3(a3), arg4(a4) {}                          \
     virtual ~Exception4 () DEAL_II_NOEXCEPT {}                            \
     virtual void print_info (std::ostream &out) const {                   \
-      out outsequence << std::endl;                                       \
+      out << "    " outsequence << std::endl;                             \
     }                                                                     \
   private:                                                                \
     const type1 arg1;                                                     \
@@ -499,7 +499,7 @@ namespace deal_II_exceptions
       arg1 (a1), arg2(a2), arg3(a3), arg4(a4), arg5(a5) {}                \
     virtual ~Exception5 () DEAL_II_NOEXCEPT {}                            \
     virtual void print_info (std::ostream &out) const {                   \
-      out outsequence << std::endl;                                       \
+      out << "    " outsequence << std::endl;                             \
     }                                                                     \
   private:                                                                \
     const type1 arg1;                                                     \
index 685623b2ed945d514d17023d5e30f22c62ddb783..405c597cc1e19d2a5535d5951727ad202efba7c5 100644 (file)
@@ -173,14 +173,14 @@ void ExceptionBase::print_exc_data (std::ostream &out) const
         << "    " << exc  << std::endl;
 
   // finally print the additional information the exception provides:
-  out << "Additional Information: " << std::endl;
+  out << "Additional information: " << std::endl;
 }
 
 
 
 void ExceptionBase::print_info (std::ostream &out) const
 {
-  out << "(none)" << std::endl;
+  out << "    (none)" << std::endl;
 }
 
 

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.