diff options
author | allen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2002-12-30 18:58:38 +0000 |
---|---|---|
committer | allen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2002-12-30 18:58:38 +0000 |
commit | f35221be95a43bfcc5b46e901b5cc4907eaa655b (patch) | |
tree | d0cb8047e4e22ec31bb07ac03fb06488a9ab9b75 | |
parent | 1e7cc07cbe0d7a1d9d97fe50cc1e53807491a2c8 (diff) |
Improve error messages
Fixed Cactus/1353
git-svn-id: http://svn.cactuscode.org/flesh/trunk@3057 17b73243-c579-4c4c-a9d2-2d5706c11dac
-rw-r--r-- | lib/sbin/ScheduleParser.pl | 9 | ||||
-rw-r--r-- | lib/sbin/parameter_parser.pl | 47 |
2 files changed, 33 insertions, 23 deletions
diff --git a/lib/sbin/ScheduleParser.pl b/lib/sbin/ScheduleParser.pl index 07caac6e..652736e4 100644 --- a/lib/sbin/ScheduleParser.pl +++ b/lib/sbin/ScheduleParser.pl @@ -232,7 +232,7 @@ sub ParseScheduleBlock if ($where !~ m:CCTK_(STARTUP|PARAMCHECK|BASEGRID|INITIAL|POSTINITIAL|RECOVER_VARIABLES|POST_RECOVER_VARIABLES|RECOVER_PARAMETERS|CHECKPOINT|CPINITIAL|PRESTEP|EVOL|POSTSTEP|ANALYSIS|TERMINATE|SHUTDOWN):) { &CST_error(0,"Schedule bin \'$where\' not recognised in schedule.ccl " . - "file of thorn $thorn","",__LINE__,__FILE__); + "file of thorn $arrangement/$thorn","",__LINE__,__FILE__); } $field+=2; } @@ -426,7 +426,8 @@ sub ParseScheduleBlock } else { - &CST_error(0,"Error parsing schedule block line '$data[$line_number]'\nUnrecognised statement","",__LINE__,__FILE__); + $data[$line_number] =~ /^(.*)\n+/; + &CST_error(0,"Unrecognised statement in schedule block ($name) in schedule.ccl for thorn $thorn/$arrangement\n\"$1\"","",__LINE__,__FILE__); } } } @@ -436,8 +437,8 @@ sub ParseScheduleBlock } else { - &CST_error(0,"Error: Missing description at end of schedule block", - "",__LINE__,__FILE__); + $message = "Missing desciption at end of schedule block ($name) in schedule.ccl for thorn $thorn/$arrangement"; + &CST_error(0,$message,"",__LINE__,__FILE__); } # Turn the arrays into strings. diff --git a/lib/sbin/parameter_parser.pl b/lib/sbin/parameter_parser.pl index 746f5ea0..7505d752 100644 --- a/lib/sbin/parameter_parser.pl +++ b/lib/sbin/parameter_parser.pl @@ -184,8 +184,9 @@ sub parse_param_ccl } else { - $message = "Missing description for $variable in thorn $thorn."; - &CST_error(0,$message,"",__LINE__,__FILE__); + $message = "Missing description for parameter $variable in param.ccl for thorn $arrangement/$thorn."; + $hint = "The first line of each parameter definition must have the syntax <TYPE> <NAME> <\"DESCRIPTION\">"; + &CST_error(0,$message,$hint,__LINE__,__FILE__); } } @@ -391,12 +392,13 @@ sub parse_param_ccl # Check description if($delim eq "" || ($delim =~ /::/ && $new_desc =~ /^\s*$/)) { - $message = "Missing description of range '$new_ranges' for parameter $thorn\::$variable"; - &CST_error(1,$message,"",__LINE__,__FILE__); + $message = "Missing range description ($new_ranges) for parameter $variable in param.ccl for thorn $arrangement/$thorn."; + $hint = "Each parameter range line should have the syntax <RANGE> :: <\"DESCRIPTION\">"; + &CST_error(1,$message,$hint,__LINE__,__FILE__); } elsif ($new_desc =~ /^\s*\".*[^\s\"]\s*$|^\s*[^\s\"].*\"\s*$/) { - $message = "Description of range for $thorn\::$variable has misplaced quotes ($new_desc)"; + $message = "Description of range for parameter $variable has misplaced quotes ($new_desc) in param.ccl for thorn $arrangement/$thorn"; &CST_error(0,$message,"",__LINE__,__FILE__); } $parameter_db{"\U$thorn $variable\E range $parameter_db{\"\U$thorn $variable\E ranges\"} description"} = $new_desc; @@ -407,8 +409,9 @@ sub parse_param_ccl # Give a warning if no range was given and it was needed if (($use_clause == 0) && ($parameter_db{"\U$thorn $variable\E ranges"}==0 && $type =~ m:INT|REAL:)) { - $message = "No range given for $variable in $thorn"; - &CST_error(0,$message,"",__LINE__,__FILE__); + $message = "No range provided for parameter $variable in param.ccl for thorn $arrangement/$thorn"; + $hint = "All definitions for integer and real parameters must provide one or more allowed ranges"; + &CST_error(0,$message,$hint,__LINE__,__FILE__); } if($block !~ m:SHARES:) { @@ -554,8 +557,9 @@ sub CheckParameterDefault { if ($default !~ m:^yes|no|y|n|1|0|t|f|true|false$:i) { - $message = "Default ($default) for boolean incorrect for $variable in $thorn"; - &CST_error(0,$message,"",__LINE__,__FILE__); + $message = "Default ($default) for boolean parameter \"$variable\" is incorrect in param.ccl for thorn $arrangement/$thorn"; + $hint = "The default value for a boolean parameter must be one of yes,no,y,n,1,0,t,f,true,false"; + &CST_error(0,$message,$hint,__LINE__,__FILE__); } } @@ -579,8 +583,9 @@ sub CheckParameterDefault } if ($foundit == 0) { - $message = "Default ($default) for keyword incorrect for $variable in $thorn"; - &CST_error(0,$message,"",__LINE__,__FILE__); + $message = "Default ($default) for keyword parameter \"$variable\" is incorrect in param.ccl for thorn $arrangement/$thorn"; + $hint = "The default value for a parameter must lie within the allowed range"; + &CST_error(0,$message,$hint,__LINE__,__FILE__); } } @@ -603,8 +608,9 @@ sub CheckParameterDefault } if ($foundit == 0) { - $message = "Default ($default) for string incorrect for $variable in $thorn"; - &CST_error(0,$message,"",__LINE__,__FILE__); + $message = "Default ($default) for string parameter \"$variable\" is incorrect in param.ccl for thorn $arrangement/$thorn"; + $hint = "The default value for a parameter must lie within an allowed range"; + &CST_error(0,$message,$hint,__LINE__,__FILE__); } } @@ -614,6 +620,7 @@ sub CheckParameterDefault $nranges=$parameter_db{"\U$thorn $variable\E ranges"}; for ($i=1; $i<=$nranges; $i++) { + $minok=0; $maxok=0; $range = $parameter_db{"\U$thorn $variable\E range $i range"}; @@ -644,10 +651,11 @@ sub CheckParameterDefault $foundit = 1; } } - if ($foundit == 0) + if ($nranges > 0 && $foundit == 0) { - $message = "Default ($default) for integer incorrect for $variable in $thorn"; - &CST_error(0,$message,"",__LINE__,__FILE__); + $message = "Default ($default) for integer parameter \"$variable\" is incorrect in param.ccl for thorn $arrangement/$thorn"; + $hint = "The default value for a parameter must lie within the allowed range"; + &CST_error(0,$message,$hint,__LINE__,__FILE__); } } @@ -687,10 +695,11 @@ sub CheckParameterDefault $foundit = 1; } } - if ($foundit == 0) + if ($nranges > 0 && $foundit == 0) { - $message = "Default ($default) for real incorrect for $variable in $thorn"; - &CST_error(0,$message,"",__LINE__,__FILE__); + $message = "Default ($default) for real parameter \"$variable\" is incorrect in param.ccl for thorn $arrangement/$thorn"; + $hint = "The default value for a parameter must lie within the allowed range"; + &CST_error(0,$message,$hint,__LINE__,__FILE__); } } |