about summary refs log tree commit diff stats
path: root/032array.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-06-23 08:20:53 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-06-23 08:20:53 -0700
commit944f4410e90209821fe6056d2b6cbb724be576c8 (patch)
treef3f809da24820561f4e17ca1ae21aedc344046c3 /032array.cc
parentadd9d36d54f02265c62026d107dd119c9310b724 (diff)
downloadmu-944f4410e90209821fe6056d2b6cbb724be576c8.tar.gz
3064 - improve an error message
Diffstat (limited to '032array.cc')
-rw-r--r--032array.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/032array.cc b/032array.cc
index 0f8ea6fe..9fe69b5c 100644
--- a/032array.cc
+++ b/032array.cc
@@ -221,7 +221,7 @@ case INDEX: {
   // Update INDEX index in Run
   vector<double> index_val(read_memory(index));
   if (index_val.at(0) < 0 || index_val.at(0) >= get_or_insert(Memory, base_address)) {
-    raise << maybe(current_recipe_name()) << "invalid index " << no_scientific(index_val.at(0)) << '\n' << end();
+    raise << maybe(current_recipe_name()) << "invalid index " << no_scientific(index_val.at(0)) << " in '" << to_original_string(current_instruction()) << "'\n" << end();
     break;
   }
   type_tree* element_type = copy_array_element(base.type);
@@ -282,7 +282,7 @@ def main [
   7:number <- copy 16
   index 1:array:number:3, 4  # less than size of array in locations, but larger than its length in elements
 ]
-+error: main: invalid index 4
++error: main: invalid index 4 in 'index 1:array:number:3, 4'
 
 :(scenario index_out_of_bounds_2)
 % Hide_errors = true;
@@ -296,7 +296,7 @@ def main [
   7:number <- copy 16
   index 1:array:point, -1
 ]
-+error: main: invalid index -1
++error: main: invalid index -1 in 'index 1:array:point, -1'
 
 :(scenario index_product_type_mismatch)
 % Hide_errors = true;