Difference between revisions of "On error"

From Second Life Wiki
Jump to navigation Jump to search
(New page: '''this is a proposed feature''' <pre> on_error(integer error_num, string error_text, integer recoverable) { if(error_num == STACK_HEAP) llResetScript(); } </pre> ===Restrictions=== If t...)
 
m (lsl code tagging)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
'''this is a proposed feature'''
'''this is a proposed feature'''
<pre>
===Example===
on_error(integer error_num, string error_text, integer recoverable)
This example should explain the proposal.
<lsl>
on_error(integer error_num, string error_text, key error_state, integer recoverable)
{
{
   if(error_num == STACK_HEAP) llResetScript();
   if(!recoverable || error_num == ERROR_STACK_HEAP) llResetScript();
  if(error_num == ERROR_BOUNDS_CHECK)
  {
    ...
    llClearErrorState(error_state);
  }
}
}
</pre>
</lsl>
===Restrictions===
===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 09: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.