![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Using Exception HandlingException handling specifies whether the program should stop when your program raises an exception. The debugger has a several facilities related to exceptions:
- Raise a named exception
- Catch an exception and break on an exception being raised.
- Propagate an exception and break on an exception being raised.
The default is to catch all exceptions in all tasks in the program wherever they are raised (Catch All). Propagate and catch requests combine to determine the action that the debugger takes when an exception is raised. When an exception in your program is raised, the debugger looks at its list of requests for exception information to determine whether to stop the program and inform you. The first matching exception request determines the action to be taken. New exception requests are added to the top of the list.
Whenever you step your program, the debugger inserts an implicit catch breakpoint. Then if an exception gets raised while stepping the debugger announces it and you are positioned at the point where it was raised.
Whether you arrive at an exception via a Catch breakpoint being hit or while stepping, if you select Step Statement or Step Over, the debugger will step your program to the handler for the exception.
The debugger also sets an implicit breakpoint at a special location to catch exceptions which are propagated all the way out of a program or task. This happens if there is no user handler for the exception being raised. This breakpoint is hit and the debugger prints a message.
Catching and Propagating Exceptions
When your program raises an exception, the debugger either catches it or propagates it. When the debugger catches an exception, execution stops at the statement that raised the exception. The name of the exception and the current location in the program are logged in the Debugger window. Propagated exceptions are ignored by the debugger and handled by the program as usual.
Exception-Handling Commands
The debugger maintains a list of requests for exception information. The following commands are provided to add, remove, and change the requests on the list: These exception-handling commands are available from a number of debugger and editor windows via the Debug menu or Toolbar buttons.
Because some type of exception handling needs to be in effect, the bottommost exception-handling request (the most general request) will never be removed. This bottommost request is always a Catch All request.
Exception handling is described in greater detail in Using the Apex Debugger.
Rational Software Corporation http://www.rational.com support@rational.com techpubs@rational.com Copyright © 1993-2001, Rational Software Corporation. All rights reserved. |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |