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

dunbarx at aol.com dunbarx at aol.com
Fri Aug 29 17:32:56 EDT 2014


There is a reason Richard Gaskin was promoted to LC ombudsman.


This is as useful and powerful as the "messageMessage".


Craig



-----Original Message-----
From: Richard Gaskin <ambassador at fourthworld.com>
To: use-livecode <use-livecode at lists.runrev.com>
Sent: Fri, Aug 29, 2014 12:29 pm
Subject: General error function? (was Re: Should "dispatch" be extended for timers?)


Thierry Douez wrote:

> A small trick:
>
>    send "want_the_return_value" to me
>    put  the result
>
> on want_the_return_value
>    return 42
> end want_the_return_value

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()

?

Ideally this could be handled like the changes to "word" and "char", in 
which new tokens are rolled out while still maintaining the older way 
also for several versions, so we have plenty of time to update code at 
our leisure, using the simpler method going forward while the old code 
continues to work.

And given that Open Language is just around the corner, wouldn't it seem 
this is the best moment to clean up the mish-mash of inconsistent error 
handling we have to deal with now?

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

 



More information about the use-livecode mailing list