Difference between revisions of "On error"

From Second Life Wiki
Jump to navigation Jump to search
m (lsl code tagging)
 
Line 2: Line 2:
===Example===
===Example===
This example should explain the proposal.
This example should explain the proposal.
<pre>
<lsl>
on_error(integer error_num, string error_text, key error_state, integer recoverable)
on_error(integer error_num, string error_text, key error_state, integer recoverable)
{
{
Line 12: Line 12:
   }
   }
}
}
</pre>
</lsl>
===Notes===
===Notes===
If this exists a section of heap may need to be reserved for the error handler stack, so adding an error handler could reduce the available heap. The error handler should probably not (and may not be allowed to) allocate any local list or string variables. Errors in the error handler are fatal.
If this exists a section of heap may need to be reserved for the error handler stack, so adding an error handler could reduce the available heap. The error handler should probably not (and may not be allowed to) allocate any local list or string variables. Errors in the error handler are fatal.

Latest revision as of 08:00, 3 April 2008

this is a proposed feature

Example

This example should explain the proposal. <lsl> on_error(integer error_num, string error_text, key error_state, integer recoverable) {

 if(!recoverable || error_num == ERROR_STACK_HEAP) llResetScript();
 if(error_num == ERROR_BOUNDS_CHECK)
 {
   ...
   llClearErrorState(error_state);
 }

} </lsl>

Notes

If this exists a section of heap may need to be reserved for the error handler stack, so adding an error handler could reduce the available heap. The error handler should probably not (and may not be allowed to) allocate any local list or string variables. Errors in the error handler are fatal.