Re: Error reporting
- Posted by mattlewis (admin) Jan 07, 2014
- 1640 views
Hi
This
if category_list[j][1] = data[i][PROD_CATEGORY][1] then
is producing this error
subscript value 1 is out of bounds, reading from a sequence of length 0
Could I request that the error has a bit more detail, like which variable is producing the error, or even just which side of the equality, or both, is at fault?
Cursory exam of ex.err - both sides seem to have a length> 0
I know I can write some debugging code, but its just a bit of a pain.
Yes, it would be good to have a more precise error. I think it's never been done because, in large part, it's a bit of a pain. Here's what we're working with (I wrote your line and did a disassembly to look at the euphoria IL code):
[/home/matt/eu/test/error.ex:13] if category_list[j][1] = data[i][PROD_CATEGORY][1] then (13) 21: 058 13 # STARTLINE: /home/matt/eu/test/error.ex(13)<<if category_list[j][1] # = data[i][PROD_CATEGORY][1] then>> 23: 109 170 # GLOBAL_INIT_CHECK: [category_list:170] 25: 109 172 # GLOBAL_INIT_CHECK: [j:172] 27: 025 170 172 176 # RHS_SUBS: [category_list:170] sub [j:172] => [_temp_:176] 31: 092 176 165 177 # RHS_SUBS_CHECK: [_temp_:176] sub [LIT 1:165] => [_temp_:177] 35: 208 176 # DEREF_TEMP: [_temp_:176] 37: 109 171 # GLOBAL_INIT_CHECK: [data:171] 39: 109 174 # GLOBAL_INIT_CHECK: [i:174] 41: 025 171 174 178 # RHS_SUBS: [data:171] sub [i:174] => [_temp_:178] 45: 092 178 169 179 # RHS_SUBS_CHECK: [_temp_:178] sub [PROD_CATEGORY:169] => [_temp_:179] 49: 208 178 # DEREF_TEMP: [_temp_:178] 51: 092 179 165 180 # RHS_SUBS_CHECK: [_temp_:179] sub [LIT 1:165] => [_temp_:180] 55: 208 179 # DEREF_TEMP: [_temp_:179] 57: 104 177 180 65 # EQUALS_IFW [_temp_:177] = [_temp_:180] goto 0061 else goto 0065 61: 208 180 # DEREF_TEMP: [_temp_:180]
We need to reconstruct the subscripting to figure out which variable it was, exactly that caused the problem. As subscripts are the result of arbitrary expressions, this could be quite involved.
Matt