Handling Exceptions
All top level events will have exception handling to prevent the application from crashing.
Important: Variables declared within the Try block of an exception handler have block scope – they aren’t available to any Catch or Finally blocks, and they aren’t available outside the Try..End Try construct. For this reason, it’s best to leave declarations outside of the Try block unless the declaration has an inherent risk of throwing an exception.
Important: You should always include a Catch section to deal with exceptions.
Ignoring an exception (by not including a Catch section) is worse than not including exception trapping to begin with because exceptions will occur and neither you nor your customers will know about them
When specifying multiple Catch blocks for an exception handler, order them from most specific to least specific. This ensures that exceptions are handled correctly.
A central exception handler will be used for unpredictable errors to keep exception handling from becoming tedious.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment