about summary refs log tree commit diff stats
path: root/082persist.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-10-01 13:13:10 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-10-01 13:13:10 -0700
commit4814bf94e75ffdcbd2a4093eb1ab67851980a37a (patch)
tree9fde405360c5499fa2ad4b25ca009ed3bcc1f57b /082persist.cc
parent5fdd8e96adcf6f572888078caee62adbee1906a4 (diff)
downloadmu-4814bf94e75ffdcbd2a4093eb1ab67851980a37a.tar.gz
2226 - standardize warning format
Always show recipe name where error occurred. But don't show internal
'interactive' name for sandboxes, that's just confusing.

What started out as warnings are now ossifying into errors that halt all
execution. Is this how things went with C and Unix as well?
Diffstat (limited to '082persist.cc')
-rw-r--r--082persist.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/082persist.cc b/082persist.cc
index 853ccb62..40241eb2 100644
--- a/082persist.cc
+++ b/082persist.cc
@@ -9,7 +9,7 @@ Recipe_ordinal["restore"] = RESTORE;
 :(before "End Primitive Recipe Implementations")
 case RESTORE: {
   if (SIZE(ingredients) != 1) {
-    raise << current_recipe_name() << ": 'restore' requires exactly one ingredient, but got " << current_instruction().to_string() << '\n' << end();
+    raise << maybe(current_recipe_name()) << "'restore' requires exactly one ingredient, but got " << current_instruction().to_string() << '\n' << end();
     break;
   }
   string filename;
@@ -20,7 +20,7 @@ case RESTORE: {
     filename = read_mu_string(ingredients.at(0).at(0));
   }
   else {
-    raise << current_recipe_name() << ": first ingredient of 'restore' should be a string, but got " << current_instruction().ingredients.at(0).to_string() << '\n' << end();
+    raise << maybe(current_recipe_name()) << "first ingredient of 'restore' should be a string, but got " << current_instruction().ingredients.at(0).to_string() << '\n' << end();
     break;
   }
   if (Current_scenario) {
@@ -62,7 +62,7 @@ Recipe_ordinal["save"] = SAVE;
 :(before "End Primitive Recipe Implementations")
 case SAVE: {
   if (SIZE(ingredients) != 2) {
-    raise << current_recipe_name() << ": 'save' requires exactly two ingredients, but got " << current_instruction().to_string() << '\n' << end();
+    raise << maybe(current_recipe_name()) << "'save' requires exactly two ingredients, but got " << current_instruction().to_string() << '\n' << end();
     break;
   }
   if (Current_scenario) break;  // do nothing in tests
@@ -74,11 +74,11 @@ case SAVE: {
     filename = read_mu_string(ingredients.at(0).at(0));
   }
   else {
-    raise << current_recipe_name() << ": first ingredient of 'save' should be a string, but got " << current_instruction().ingredients.at(0).to_string() << '\n' << end();
+    raise << maybe(current_recipe_name()) << "first ingredient of 'save' should be a string, but got " << current_instruction().ingredients.at(0).to_string() << '\n' << end();
     break;
   }
   if (!scalar(ingredients.at(1))) {
-    raise << current_recipe_name() << ": second ingredient of 'save' should be an address:array:character, but got " << current_instruction().ingredients.at(1).to_string() << '\n' << end();
+    raise << maybe(current_recipe_name()) << "second ingredient of 'save' should be an address:array:character, but got " << current_instruction().ingredients.at(1).to_string() << '\n' << end();
     break;
   }
   ofstream fout(("lesson/"+filename).c_str());