Error Trapping - name of the currently executing script?

The place to discuss anything and everything about running your LiveCode on Android

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
BarrySumpter
Posts: 1201
Joined: Sun Apr 24, 2011 2:17 am

Error Trapping - name of the currently executing script?

Post by BarrySumpter » Fri Jun 24, 2011 2:53 am

Currently trying to trap error on Android

Trying to setup a standard error trapping for all routines.

Anyone know how to return the name of the currently executing script?

Code: Select all

on mouseUp
   
   --   Answer the short name of me     -- of this control
   --   Answer the short name of this card
   --   Answer the short name of this stack
   --   Answer the currentcard of this stack
   
   Answer the short name of this script
   
   
end mouseUp
All my best,
Barry G. Sumpter

Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5147
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Error Trapping - name of the currently executing script?

Post by Mark » Fri Jun 24, 2011 11:51 pm

Hi Barry,

Try the executionContext.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

BarrySumpter
Posts: 1201
Joined: Sun Apr 24, 2011 2:17 am

Re: Error Trapping - name of the currently executing script?

Post by BarrySumpter » Sat Jun 25, 2011 12:26 am

Nice!
Thanks for that.

Code: Select all

on mouseUp
   
   Answer the short name of me     -- of this control
   Answer the short name of this card
   Answer the short name of this stack
   Answer the currentcard of this stack
   
  -- --Answer the name of the script --of me
   --Answer the name of the executionContext
   
   local tHandler
   
   answer executionContexts
   
   put executionContexts into tHandler
   answer item -2 of line -1 of tHandler
   
   
   put item -2 of line -1 of the executionContexts into tHandler
   --answer "An error occurred in the handler: " & tHandler
   
end mouseUp
All my best,
Barry G. Sumpter

Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.

BarrySumpter
Posts: 1201
Joined: Sun Apr 24, 2011 2:17 am

Re: Error Trapping - name of the currently executing script?

Post by BarrySumpter » Sat Jun 25, 2011 12:30 am

Nice!
Thanks for that.

Code: Select all

on mouseUp
   
   Answer the short name of me     -- of this control
   Answer the short name of this card
   Answer the short name of this stack
   Answer the currentcard of this stack
   
  -- --Answer the name of the script --of me
   --Answer the name of the executionContext
   
   local tHandler
      -- answer executionContexts
      put item -2 of line -1 of the executionContexts into tHandler
      answer "An error occurred in the handler: " & tHandler
   
end mouseUp
Is there anyway to enumerate this structure?
i.e. - Important: The value of the executionContexts may be changed in future versions of LiveCode

Sometimes there are hidden or special MessageBox keywords that allow us to display structures.
I'd just like to be able to know the item names of the executionContexts content.

oops - just found this:
Value
The executionContexts is similar to a call stack, it consists of a list of contexts, one per line, with the most recent context at the end.

Each context is a string of the form:
<object-long-id>,<handler-name>,<line-number>

button id 1003 of card id 1002 of stack "C:/LiveCode/ErrorTrapping.livecode",mouseUp,17

object-long-id = button id 1003 of card id 1002 of stack "C:/LiveCode/ErrorTrapping.livecode"
handler-name = mouseUp
line-number = 17

is there a way to pull out the Name of button id 1003 and the Name of button id 1003?

Code: Select all

 Answer the short name of me     -- of this control
   Answer the short name of this card
   Answer the short name of this stack
yeah OK getting circular redundancy here in my thinking. LOL
All my best,
Barry G. Sumpter

Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.

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

Re: Error Trapping - name of the currently executing script?

Post by jacque » Sat Jun 25, 2011 3:59 am

The executionContext isn't going away any time soon, it's been around forever with the same warning. I think the IDE itself still uses it.
is there a way to pull out the Name of button id 1003
Um... "the name of btn id 1003", or if you prefer, "the short name of btn id 1003". :)
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Android Deployment”