IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
Paradox
Search Paradox Group:

Advanced
-Collapse +Expand Paradox To/From
To/FromCODEGuides
-Collapse +Expand Paradox Store
PRESTWOODSTORE

Prestwood eMagazine

January Edition
Subscribe now! It's Free!
Enter your email:

   ► KBDesktop Data...Paradox & Ob...ObjectPAL Co...OPAL: Langua...   Print This     
 
Paradox OPAL: Language Details:
ObjectPAL Exception Trapping (try...onFail)
 
Posted 14 years ago on 11/3/2008
Paradox Code Snippet:
 A flashcard from our Paradox Flashcards Library
 A code snippet from our Paradox Code Snippets Page

KB101369

Languages Focus: Exception Trapping

A common usage of exception handling is to obtain and use resources in a "try-it" block, deal with any exceptions in an "exceptions" block, and release the resources in some kind of "final" block which executes whether or not any exceptions are trapped.

ObjectPAL Exception Trapping

ObjectPAL has a try...onFail statement but does not have a finally-type component. However, the code afer endTry will execute.

try
onFail
endTry
Syntax Example:
var
i SmallInt
endVar
try
i = 0
i = 1/i
onFail
msgInfo("", "You cannot divide by zero.")
endTry

Here is an example from a pushButton event:

method pushButton(var eventInfo Event)
var
 i SmallInt
endVar
 
errorTrapOnWarnings(True)
 
try
  i = 0
  i = 1/i
  msgInfo("", "This line of code never executes.")
onFail
  msgInfo("", "You cannot divide by zero.")
endTry
 
msgInfo("", "This line always executes.")
endMethod

The following example shows you the last ObjectPAL error:

errorTrapOnWarnings(yes)
try
  ;Your code here
onFail
  msgStop( errorCode(), errorMessage() )
  ;You could also use errorShow()
endTry

More Info

Article:  Debugging ObjectPAL Code

Comments

1 Comments.
Share a thought or comment...
Comment 1 of 1

Object PAL exception trapping is the part for some of those kind of things on which we need to just know some good points. We want or you can said we desire for help to write an essay but exception trapping with all these objects are be important and we people want to just understand it.

Posted 19 months ago
 
Write a Comment...
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P1253A1
Enter key:
Code Contributed By Mike Prestwood:

Mike Prestwood is a drummer, an author, and creator of the PrestwoodBoards online community. He is the President & CEO of Prestwood IT Solutions. Prestwood IT provides Coding, Website, and Computer Tech services. Mike has authored 6 computer books and over 1,200 articles. As a drummer, he maintains play-drums.com and has authored 3 drum books. If you have a project you wish to discuss with Mike, you can send him a private message through his PrestwoodBoards home page or call him 9AM to 4PM PST at 916-726-5675 x205.

Visit Profile

 KB Article #101369 Counter
7437
Since 11/3/2008
Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site: 
www.prestwood.com


©1995-2022 Prestwood IT Solutions.   [Security & Privacy]