[Opensim-dev] Improving LSL Script Error Handling
David Rowe
david at ctrlaltstudio.com
Sat Jan 18 22:48:50 UTC 2014
Hi,
I've been looking at script error handling in LSL_Api.cs and propose to tidy it up.
Currently, LSL script errors are handled in a variety of ways:
- llSay(0, "..."): Says error in public chat, whereas the error should be shouted on the debug channel (at least for all the occurrences I've checked so far) and displayed in the Script Warning/Error dialogue box.
- ShoutError("..."): Shouts errors on the debug channel (in accordance with the LSL documentation). But these errors are not displayed in the viewer's Script Warning/Error dialogue box.
- LSLError("..."): throw new ScriptException("LSL Runtime Error: " + msg); Displays a .NET exception in both the viewer's Script Warning/Error dialogue box and the OpenSim console.
- Deprecated("..."): throw new ScriptException("Command deprecated: " + command); Displays a .NET exception in both the viewer's Script Warning/Error dialogue box and the OpenSim console.
- NotImplemented("..."): throw new NotImplementedException("Command not implemented: " + command); Displays a .NET exception in both the viewer's Script Warning/Error dialogue box and the OpenSim console.
- throw new Exception(...): Displays a .NET exception in both the viewer's Script Warning/Error dialogue box and the OpenSim console.
- throw new ScriptException(...): Displays a .NET exception script in both the viewer's Script Warning/Error dialogue box and the OpenSim console.
What I propose to do is consolidate things down to use just three methods (that don't produce .NET exceptions):
- ShoutError() Shout the error details on the debug channel.
- Deprecated() Shout "Command is deprecated" on the debug channel.
- NotImplemented() Shout "Command is not implemented" on the debug channel.
And make all three also display the error in the viewer's Script Warning/Error dialogue box.
Plus miscellaneous tidy ups such as ...
- Don't included the LSL method's name in errors shouted on the debug channel; the LSL method's name is already included in the "name" parameter of the message shouted.
- Add Deprecated() calls to deprecated LSL methods that currently do nothing or just sleep with no user feedback.
And replicate this approach in OSSL_Api.cs which has similar issues.
If people think that this is a good idea, I'll create a Mantis entry and proceed. Anyone interested in reviewing things as I go?
David
SL/OSgrid: Strachan Ofarrel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://opensimulator.org/pipermail/opensim-dev/attachments/20140118/6de3b6fd/attachment-0001.html>
More information about the Opensim-dev
mailing list