General error function? (was Re: Should "dispatch" be extended for timers?)

Bob Sneidar bobsneidar at iotecdigital.com
Mon Sep 29 12:21:04 EDT 2014


Doesn’t Applescript have an On Error function handler? I was looking for something of this sort when I first began working with Revolution and of course was directed to try/catch, but having an on error function, and then being able to turn off debugging would be a cleaner way of doing it. This way, you could respond to different errors in different ways. For instance if a database operation failed, you could enter into a repeat loop and prompt the user to try again. If the user canceled you could gracefully bail out of the app. Other more critical errors you would alert the user and then bail out without retrying.

Bob S


On Aug 29, 2014, at 09:28 , Richard Gaskin <ambassador at fourthworld.com<mailto:ambassador at fourthworld.com>> wrote:

This raises another question:

Should we have a general error function?

Right now "the result" sometimes contains data, but sometimes contains error info.  The "it" variable also sometimes contains data, but (almost?) never contains error info.   Sometimes errors put error info in "the result", and other times they explicitly throw an error, requiring the use of try/catch in those cases but not others.

That's a whole lotta "sometimes".

We have a function for system errors in sysError, but that only applies to things happening outside of LC (file I/O, processes, etc.).

Wouldn't life be much easier if we had one reliable way to obtain info whenever an error occurs in our scripts?

Maybe simply:

 get scriptError()




More information about the use-livecode mailing list