getStackTrace

Synopsis

@ getStackTrace()

Within the context of a catch block, this function will return a trace of the Sleep call stack that caused the caught exception condition to occur. Returns an empty array otherwise.

Returns

An array of sleep.runtime.ScriptInstance$SleepStackElement objects. They have a decent String representation if you choose to utilize that.

Side Effects / Notes

Examples

sub bar { throw "I chose to do this :)"; } sub foo { bar(); } try { foo(); } catch $exception { warn("Error is: $exception"); printAll(getStackTrace()); }

Warning: Error is: I chose to do this :) at getStackTrace.sl:17 getStackTrace.sl:13 &foo() getStackTrace.sl:8 &bar() getStackTrace.sl:3 <origin of exception>

See Also