On August 17, 2007 at 08:02, André du Fresne said...
| Why all this try, catch, diagnostics? I don't
understand it - all I want is to have this.process()
looped, but I couldn't get it to work.
The try/catch is put in place to facilitate catching errors in your script, logging them and not letting them propagate out into the Pronto Code. This becomes increasingly important when doing TCP socket or RS-232 programming and using asynchronous onData notifications. If you let an error propagate out of your own script, especially in TCP, Pronto will likely close and tear down the socket.
General programming philosophy (aka best practice) is. If your code generates errors, catch and handle/log them and don't let the propagate out into code that you don't own nor do you know how it behaves when an unexpected error is introduced.