On error

From Second Life Wiki
Jump to navigation Jump to search

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.