]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Improve the wording of an exception. 33/head
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Sat, 26 Jul 2014 12:58:55 +0000 (07:58 -0500)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Sat, 26 Jul 2014 12:58:55 +0000 (07:58 -0500)
I ran into this exception and couldn't figure out what's wrong without looking at the source code.

source/base/parsed_function.cc

index 14b975a039a0e4ddde600b0ef24c818256a9092d..47dea746d34801bc5e6f57fd55609c7367642d32 100644 (file)
@@ -128,7 +128,7 @@ namespace Functions
     constants["pi"] = numbers::PI;
     constants["Pi"] = numbers::PI;
 
-    unsigned int nn = (Utilities::split_string_list(vnames)).size();
+    const unsigned int nn = (Utilities::split_string_list(vnames)).size();
     switch (nn)
       {
       case dim:
@@ -140,7 +140,13 @@ namespace Functions
         function_object.initialize(vnames, expression, constants, true);
         break;
       default:
-        AssertThrow(false, ExcMessage("Not the correct size. Check your code."));
+        AssertThrow(false,
+                    ExcMessage("The list of variables specified is <" + vnames
+                               + "> which is a list of length "
+                               + Utilities::int_to_string(nn)
+                               + " but it has to be a list of length equal to"
+                               + " either dim (for a time-independent function)"
+                               + " or dim+1 (for a time-dependent function)."));
       }
   }
 

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.