Program randomly resetting?

Ok, so I am seeing a strange issue where I will randomly see my device reset.

I usually print out “done for now” before calling imp.wakeup().

But I am seeing randomly I just get where I would normally see my logs, then it reboots and starts up again

10/31/2012 12:26:57: Device booting

I have a try/catch around the code in question and it never gets caught. Is this just beta growing pains, or am I doing something horribly wrong (likely)?

Ok, so my exception handler wasn’t printout out properly:

exception caught: stack overflow, cannot resize stack while in a metamethod

Ok, so better question. Is there a better way to get context on where the error is occurring? That message is useless.

Running squirrel locally I get more details of errors:

AN ERROR HAS OCCURED [the index ‘foo’ does not exist]

CALLSTACK
*FUNCTION [timed_update()] PoolController.js line [899]
*FUNCTION [main()] PoolController.js line [912]

LOCALS
[pool] INSTANCE
[imp] INSTANCE
[controller] INSTANCE
[gWakeupTime] 60
[controlUpdates] 0
[airUpdates] 0
[waterUpdates] 0
[failures] 134
[successes] 0
[packets_read] 804
[this] TABLE
[controller] INSTANCE
[pool] INSTANCE
[gLogLevel] 4
[gWakeupTime] 60
[imp] INSTANCE
[server] INSTANCE
[hardware] INSTANCE
[vargv] ARRAY
[this] TABLE

Release-9 has better error reporting (including line numbers).

If you’re getting the stack resize errors, read peter’s post here:

http://forums.electricimp.com/discussion/313/error-in-execution#Item_2

…particularly about how you should be creating objects in the root table.