# Error Handling - ArrayIndexOutOfBoundsException

**URL:** <https://forum.inductiveautomation.com/t/error-handling-arrayindexoutofboundsexception/20011>\
**Category:** Ignition\
**Created:** [October 6, 2018, 4:20pm UTC](https://forum.inductiveautomation.com/t/error-handling-arrayindexoutofboundsexception/20011 "2018-10-06T16:20:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nmaloney](https://avatars.discourse-cdn.com/v4/letter/n/8dc957/32.png) [@nmaloney](https://forum.inductiveautomation.com/u/nmaloney)\
**Post date:** [October 6, 2018, 4:20pm UTC](https://forum.inductiveautomation.com/t/error-handling-arrayindexoutofboundsexception/20011/1 "2018-10-06T16:20:01Z")

</div>

I have a situation where I need to handle an exception due to an ArrayIndexOutOfBoundsException. In the manual, it says that this can be called out for an exception-specific failover. However, another error is thrown saying that ‘ArrayIndexOutOfBoundsException’ is not defined.

Using the example code from the manual, this is the code I’m trying to use.

myDataset = system.dataset.toDataSet([“colName”], [[0]])  
try:  
print myDataset.getValueAt(0,5)  
except ArrayIndexOutOfBoundsException:  
print “Index Out of Bounds”

Any thoughts would be very helpful.

Thanks

---

<div class="post-metadata">

**Author:** ![nmaloney](https://avatars.discourse-cdn.com/v4/letter/n/8dc957/32.png) [@nmaloney](https://forum.inductiveautomation.com/u/nmaloney)\
**Post date:** [October 6, 2018, 4:24pm UTC](https://forum.inductiveautomation.com/t/error-handling-arrayindexoutofboundsexception/20011/2 "2018-10-06T16:24:56Z")

</div>

I answered my own question. The key is to import java.lang.Exception and change the except to except java.lang.ArrayIndexOutOfBoundsException:.

Code now look like this and works:

import java.lang.Exception

myDataset = system.dataset.toDataSet([“colName”], [[0]])  
try:  
print myDataset.getValueAt(0,5)  
except java.lang.ArrayIndexOutOfBoundsException:  
print “Index Out of Bounds”

Would be nice if that page in the manual could be updated because some of the code examples are incorrect.
