user54219: I have a long code written in Arduino101 that works fine. I use a prepared function (connected to a library) in my code that I have not written it. My input to this function is an array. In 99.9999..% of the time, the function works great. However, it might stops due to an unknown reason, maybe because of my wrong input. This causes the program to stop. 
My question is: how to bypass this function if it fails for any reason? Something like 'on error' function in normal programming. 
Thanks a lot in advance,

user2967: If your function is crashing then there is no way to recover. Arduinos are unprotected real mode devices. If your code does something invalid, your program crashes and the device will likely either hang or restart.
You need to debug your function, or find the invalid data you are passing into it.

54219: <p>I have a long code written in Arduino101 that works fine. I use a prepared function (connected to a library) in my code that I have not written it. My input to this function is an array. In 99.9999..% of the time, the function works great. However, it might stops due to an unknown reason, maybe because of my wrong input. This causes the program to stop. 
My question is: how to bypass this function if it fails for any reason? Something like 'on error' function in normal programming. </p>

<p>Thanks a lot in advance,</p>
 2967: <p>If your function is crashing then there is no way to recover. Arduinos are unprotected real mode devices. If your code does something invalid, your program crashes and the device will likely either hang or restart.</p>

<p>You need to debug your function, or find the invalid data you are passing into it.</p>
