 |
 |
|
|
|
Exception Handling Guidelines
Developers are recommended to follow these guidelines when raising exceptions:
- Always throw exceptions, rather than simply returning an error code
or HRESULT.
- Use inner exceptions or chained exceptions, to enable the previous
exception to be notified of the new error exception.
- When using inner exceptions, try to maintain a short chain of exception.
- Be aware that the stack trace begins when the exception is thrown.
The stack trace starts from where the exception is thrown, not where
it is newed.
- Always use helper functions to handle
exceptions. Classes frequently throw the same exception from different
places within the implementation.
Developers are recommended to follow these guidelines when handling
exceptions:
- Follow the steps for creating structured code
statements.
- Always use helper functions to handle exceptions.
Classes frequently throw the same exception from different places within
the implementation.
- Only handle the exception in the foundation class, when you know
how to recover from the exception. Otherwise, pass the exception up
to the parent in the second parameter, along with any additional information.
- To display the error messages, use the HandleException function
defined in the FnError object, can be used to redirect the ASPX
Page container to the Error Page. The Error Page will display the stack
trace for each error using a consistent format.
|