![]() ![]() |
|
Open Client Developer's Guide | |
Search | Index | Glossary | | |
![]() |
|
![]() |
![]() |
![]() |
Exception HandlingDevelopers are encouraged to implement try...catch…finally blocks to handle error exceptions in their Web applications. A try...catch block consists of a statement that attempts to execute something that might cause an exception to occur. When an exception does occur, execution control is immediately passed to the catch block, which then deals with the exception. If an exception does not occur, then the application code executes normally.
When throwing an exception, developers should clean up the intermediate results. This enables calling functions to assume that there will be no side effects when an exception is thrown. A finally block can also be added after the catch block, to contain code segments that will execute whether or not any exceptions are raised. Catch blocks are tried in the order in which they are declared within the try...catch statement. When using multiple catch blocks, developers should put the finest-grained exception first and the base (most general) exception last.
|
![]() |
|