From fe9f07155abf6e5326d0e27c1b367181f0fcbfa8 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 20 Nov 2015 11:32:21 -0800 Subject: 2465 - improve an error message Thanks Caleb Couch. --- 030container.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/030container.cc b/030container.cc index 29772b88..49655db5 100644 --- a/030container.cc +++ b/030container.cc @@ -161,7 +161,7 @@ case GET: { // Update GET product in Check const reagent element = element_type(base, offset_value); if (!types_match(product, element)) { - raise_error << maybe(get(Recipe, r).name) << "'get' " << offset.original_string << " (" << offset_value << ") on " << get(Type, base_type).name << " can't be saved in " << product.original_string << "; type should be " << debug_string(element.type) << " but is " << debug_string(product.type) << '\n' << end(); + raise_error << maybe(get(Recipe, r).name) << "'get " << base.original_string << ", " << offset.original_string << "' should write to " << debug_string(element.type) << " but " << product.name << " has type " << debug_string(product.type) << '\n' << end(); break; } break; @@ -241,7 +241,7 @@ recipe main [ 14:number <- copy 36 15:address:number <- get 12:point-number/raw, 1:offset ] -+error: main: 'get' 1:offset (1) on point-number can't be saved in 15:address:number; type should be number but is
>> ++error: main: 'get 12:point-number/raw, 1:offset' should write to number but 15 has type
>> //: we might want to call 'get' without saving the results, say in a sandbox @@ -303,7 +303,7 @@ case GET_ADDRESS: { // ..except for an address at the start element.type = new type_tree(get(Type_ordinal, "address"), element.type); if (!types_match(product, element)) { - raise_error << maybe(get(Recipe, r).name) << "'get-address' " << offset.original_string << " (" << offset_value << ") on " << get(Type, base_type).name << " can't be saved in " << product.original_string << "; type should be " << debug_string(element.type) << '\n' << end(); + raise_error << maybe(get(Recipe, r).name) << "'get-address " << base.original_string << ", " << offset.original_string << "' should write to " << debug_string(element.type) << " but " << product.name << " has type " << debug_string(product.type) << '\n' << end(); break; } break; @@ -359,7 +359,7 @@ recipe main [ 14:number <- copy 36 15:number <- get-address 12:point-number/raw, 1:offset ] -+error: main: 'get-address' 1:offset (1) on point-number can't be saved in 15:number; type should be
>> ++error: main: 'get-address 12:point-number/raw, 1:offset' should write to
>> but 15 has type number //:: Allow containers to be defined in mu code. -- cgit 1.4.1-2-gfad0