Databases Reference
In-Depth Information
Put Thought Into Your Error Handling
Managing errors for plug-ins can be a tricky thing. The biggest question is, do you raise a hard error (i.e.,
completely stop everything) or do you raise a soft error and allow the user to continue using the
application?
The answer is... “It depends.” To help determine how to handle each type of error you expect to
encounter, you need to put yourself in the user's shoes. Ask yourself this: “Can the user properly
continue if this error occurs?”
For a simple example, think about an item plug-in. If you encounter an error in the render function
(i.e., the function that displays the item), what should you do? At a high level you have two options: raise
an application error, making the page unusable by the user, or try to soften the blow and display a
generic Unhandled error occurred. Please contact your system administrator. error message. In this
case, it would make sense to raise an application error; the user couldn't, and probably shouldn't,
continue with the application, since it's missing some data that it expects the user to see and modify.
For an example of a soft error, imagine that an error occurs in an AJAX function on the
server/PL/SQL side. If you raise an application error in the PL/SQL block, it really doesn't do much, as
the user won't get the error message. Instead, they're left waiting for an expected response from the
server. As a workaround, you can explicitly catch errors and then send a message back to the JavaScript
code letting it know what has happened. The JavaScript code can then display a soft error message to the
user. This technique is shown in Chapter [insert number], Region Plug-in.
Write Good Help Text
Plug-ins allow for help text in two main areas: the plug-in and custom attributes. Overall, plug-in help
can be added by editing the plug-in and going to the Help Text section as shown in Figure 7-16. The
plug-in help text is in HTML markup.
Figure 7-16. Plug-in help text
To add/modify help text for a custom attribute, edit the custom attribute and scroll to the Help Text
region shown in Figure 7-17. The help text supports HTML markup (though you'll need to type it
 
Search WWH ::




Custom Search