That helps you catch all errors, not just OutOfBounds
Set a breakpoint at the line and follow execution in the debugger - you can see the values for line_index and a so you’ll have a better idea why that line throws an error.
[quote=114520:@David Smith]AS i am currently in testing the array line_colour isn’t fully populated with every line yet so I sometimes get an outofbounds
but the above doesnt catch it and at runtime I get an error on
if line_colours(line_index,a)="" then
can someone help me catch this error so I can continue development?
[/quote]
What is the error? OutOfBoundsException? If so, then your code definitely will catch it. Whether or not that works for your program flow, I can’t say. Note that if you are running in the debugger, it will stop on an exception even if you catch it (unless you have Project->Break on Exceptions turned off).
Considering you are just processing an array, there seems to be little need to rely on catching an exception to handle the flow. Just test the array index values to make sure they are in range.
I knew it would throw a few out of bounds errors as I am in the process of populating a text file which is then read in to populate the array. I am doing it in stages so I can test that the latest entries are functioning properly, but to function fully other entries are called further in that I have not yet populated
I will give your recommendations a go when I am next able to (currently at work! & moving the mother inlaw at the weekend)
This is where I am tripping up I am running in debugger but have not made the above change
Explains why it wasn’t working how I wanted it to! Thanks for the useful links on error handling I will certainly be adding these to my program to make it far more stable