General error function? (was Re: Should "dispatch" be extended for timers?)
Richard Gaskin
ambassador at fourthworld.com
Fri Aug 29 12:28:18 EDT 2014
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
More information about the use-livecode
mailing list