Error info about try/catch

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

ale870
Posts: 250
Joined: Tue Apr 22, 2008 9:17 am
Contact:

Error info about try/catch

Post by ale870 » Thu Oct 23, 2014 9:26 am

Hello,

I'm using try/catch to detect some errors. This structure return some error numbers but I cannot "decode" them.
Please can you give me a reference to read them?

For example (trivial example):

Code: Select all

try
   get 5/0
catch err
  answer err
end try
I get:
379,337,6
223,337,1

So... ???

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Error info about try/catch

Post by Klaus » Thu Oct 23, 2014 11:48 am

Hi ale870,

what you see are the hints rom the ERRORDIALOG, check the dictionary for more info.
...
The executionError parameter is a standard LiveCode error backtrace in the form:
<error-code>,<line-number>,<column-number>[,<hint>]
...

Best

Klaus

ale870
Posts: 250
Joined: Tue Apr 22, 2008 9:17 am
Contact:

Re: Error info about try/catch

Post by ale870 » Thu Oct 23, 2014 12:35 pm

Klaus wrote:Hi ale870,

what you see are the hints rom the ERRORDIALOG, check the dictionary for more info.
...
The executionError parameter is a standard LiveCode error backtrace in the form:
<error-code>,<line-number>,<column-number>[,<hint>]
...

Best

Klaus
Great thank you!
But the problem is not yet solved since, reading the documentation and making tests, error codes are stored inside revErrorDisplay, and that stack is available only when using the IDE (so I cannot get info during runtime :-(
It is crazy that I cannot include that stack while I distribute my application.
Any workaround?
Runtime Revolution Widgets, tutorials, tips & tricks and more!
http://runrevwidgets.com/wiki

Neurox66
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 120
Joined: Tue May 22, 2012 1:57 pm
Location: Vicenza (Italy)
Contact:

Re: Error info about try/catch

Post by Neurox66 » Thu Oct 23, 2014 1:10 pm

Paolo Borzini | paolo@borzini.it
The WhiteFly Software | www.thewhitefly.it
Service on line for printers | www.4pellicole.it

ale870
Posts: 250
Joined: Tue Apr 22, 2008 9:17 am
Contact:

Re: Error info about try/catch

Post by ale870 » Thu Oct 23, 2014 3:06 pm

Neurox66 wrote:Hi,

read this...

http://runtime-revolution.278305.n4.nab ... 53157.html

Paolo
Thank you! That RevOnline Error Lookup is amazing! I can extract and embed those error codes inside my app!
Thank you again, I solved my problem!
Runtime Revolution Widgets, tutorials, tips & tricks and more!
http://runrevwidgets.com/wiki

dbeugeling
Posts: 12
Joined: Thu Feb 12, 2015 12:22 pm

Re: Error info about try/catch

Post by dbeugeling » Fri May 26, 2023 12:43 pm

Hi,

The link is no longer valid.
Is there an updated one?
Thanks

Dirk

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Error info about try/catch

Post by Klaus » Fri May 26, 2023 1:44 pm

Dag Dirk,

here a little stack from Jacque Gay, which does it locally. :-)


Best

Klaus
Attachments
Error Lookup.livecode.zip
(17.02 KiB) Downloaded 61 times

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Error info about try/catch

Post by FourthWorld » Fri May 26, 2023 2:52 pm

It seems weird to me that there isn't a documented function for looking up the error string from the error code number.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Error info about try/catch

Post by jacque » Fri May 26, 2023 6:02 pm

FourthWorld wrote:
Fri May 26, 2023 2:52 pm
It seems weird to me that there isn't a documented function for looking up the error string from the error code number.
It's in the entry for errorDialog in the dictionary.

@klaus Richard and I co-wrote the error lookup stack. It's also available in the LC user examples online.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Error info about try/catch

Post by FourthWorld » Fri May 26, 2023 7:00 pm

jacque wrote:
Fri May 26, 2023 6:02 pm
FourthWorld wrote:
Fri May 26, 2023 2:52 pm
It seems weird to me that there isn't a documented function for looking up the error string from the error code number.
It's in the entry for errorDialog in the dictionary.
Thank you. I'd forgotten about the scriptExecutionErrors.

That these sorts of questions keep coming up several times a year suggests a rethink on error handling may be helpful. ErrorDialog is used in many contexts unrelated to even potentially showing a dialog window, and there are opportunities to streamline decoding the error data, as well as making error handling more consistent than the current collection of sometimes rules (sometimes we check errorDialog, sometimes we need to use sysError, sometimes we check the result, sometimes we need to structure our code specifically for error handling using try/catch...).
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

stam
Posts: 2636
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Error info about try/catch

Post by stam » Fri May 26, 2023 7:56 pm

I've just noticed that scriptExecutionErrors returns empty in standalones, further reducing it's value...
You'd need to duplicate scriptExecutionErrors in your stack if you wanted to provide proper feedback on errors in a standalone. Not any degree of difficult, but why the extra step?

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Error info about try/catch

Post by jacque » Fri May 26, 2023 8:01 pm

stam wrote:
Fri May 26, 2023 7:56 pm
I've just noticed that scriptExecutionErrors returns empty in standalones, further reducing it's value...
You'd need to duplicate scriptExecutionErrors in your stack if you wanted to provide proper feedback on errors in a standalone. Not any degree of difficult, but why the extra step?
Maybe because there is no debugger included in standalones.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

stam
Posts: 2636
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Error info about try/catch

Post by stam » Fri May 26, 2023 8:07 pm

jacque wrote:
Fri May 26, 2023 8:01 pm
stam wrote:
Fri May 26, 2023 7:56 pm
I've just noticed that scriptExecutionErrors returns empty in standalones, further reducing it's value...
You'd need to duplicate scriptExecutionErrors in your stack if you wanted to provide proper feedback on errors in a standalone. Not any degree of difficult, but why the extra step?
Maybe because there is no debugger included in standalones.
Do you need a debugger to get the error codes? I ask because the standalone settings have a 'bug reports' section which I presume relates to LC error codes being generated. How else would this be triggered? And I haven't checked but had assumed the error numbers returned would do so in standalones as well, or is this also not the case?

(Also - Richard elegantly showed a debugger that can be included in a standalone...)

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Error info about try/catch

Post by jacque » Fri May 26, 2023 8:17 pm

The scriptExecutionErrors seems to be an IDE thing. If you want to catch all errors, not just the ones that LC reports in standalones (i.e., catch silent errors) you can use an errorDialog handler. That's what I usually do.

Code: Select all

on errorDialog pErr
  answer "Error:" && the params &cr& pErr
end errorDialog
Edit: Error info is generated in a standalone but unless they are fatal, users won't see a dialog. The above catches all of them.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

stam
Posts: 2636
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Error info about try/catch

Post by stam » Fri May 26, 2023 8:22 pm

jacque wrote:
Fri May 26, 2023 8:17 pm
The scriptExecutionErrors seems to be an IDE thing. If you want to catch all errors, not just the ones that LC reports in standalones (i.e., catch silent errors) you can use an errorDialog handler. That's what I usually do.
Errrrmmm... now I'm confused.
Dictionary on scriptExecutionErrors wrote:Reports a list of all possible LiveCode script execution errors.
It's just a return-delimited list of LC errors, whose line number corresponds to the error number. In itself it catches nothing, it's just a a verbose dictionary. So why should it not be in standalones ;)

Also - when the time time I included this in a standalone for distribution, it kept firing with either numbers or nothing and was always non-fatal - users just dismissed it and I just shrugged my shoulders :)

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”