Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

TRY…CATCH…FINALLY…END TRY – PB Docs 2019 – PowerBuilder Library

TRY…CATCH…FINALLY…END TRY – PB Docs 2019

TRY…CATCH…FINALLY…END TRY

Description

Isolates code that can cause an exception, describes what to do if
an exception of a given type is encountered, and allows you to close files
or network connections (and return objects to their original state)
whether or not an exception is encountered.

Syntax

Parameter

Description

trystatements

Block of code that might potentially throw an
exception.

ThrowableTypeN

Object type of exception to be caught. A CATCH block
is optional if you include a FINALLY block. You can include
multiple CATCH blocks. Every CATCH block in a try-catch block must
include a corresponding exception object type and a local variable
of that type.

exIdentifierN

Local variable of type ThrowableTypeN.

catchstatementsN

Code to handle the exception being
caught.

cleanupstatements

Cleanup code. The FINALLY block is optional if you
include one or more CATCH block.

Usage

The TRY block, which is the block of statements between the TRY and
CATCH keywords (or the TRY and FINALLY keywords if there is no
CATCH clause), is used to isolate code that might potentially throw an
exception. The statements in the TRY block are run unconditionally until
either the entire block of statements is executed or some statement in the
block causes an exception to be thrown.

Use a CATCH block or multiple CATCH blocks to handle exceptions
thrown in a TRY block. In the event that an exception is thrown, execution
of the TRY block is stopped and the statements in the first CATCH block
are executed — if and only if the exception thrown is of the same type or
a descendant of the type of the identifier following the
CATCH keyword.

If the exception thrown is not the same type or a descendant type of
the identifier in the first CATCH block, the exception is not handled by
this CATCH block. If there are additional CATCH blocks, they are evaluated
in the order they appear. If the exception cannot be handled by any of the
CATCH blocks, the statements in the FINALLY block are executed.

The exception then continues to unwind the call stack to any outer
nested try-catch blocks. If there are no outer nested blocks, the
SystemError event on the Application object is fired.

If no exception is thrown, execution continues at the beginning of
the FINALLY block if one exists; otherwise, execution continues on the
line following the END TRY statement.

FINALLY clause restriction

Do not use RETURN statements in the FINALLY clause of a
TRY-CATCH block. This can prevent the exception from being caught by its
invoker.

See also

THROW


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x