| Last Update: | Jul 28, 2003 |
| Status: | Production |
| Version: | Any PDK Release |
Oracle9iAS Portal provides a set of APIs for generating your error messages and presenting these errors in standard ways in your PL/SQL portlets. For an introductory overview of Error Handling Services, please refer to the Primer on Error Handling.
Error handling services are available through the wwerr_api and wwerr_api_error_ui packages.
This article describes how the Error Handling services are implemented using the Services Example. It provides a guideline for adding the Error Handling service to your portlet functionalityThe general model for working with the error handling can be described as follows:
Note: Remember to seed the NLS strings for your error messages. The document on Implementing NLS Service describes how string definitions are loaded into the database.
The standard UI for error messages also provides a navigation link to go back to the previous page. It also includes a 'Help' icon to link to the specified Help URL.
CREATE OR REPLACE
package body SERVICES_PORTLET
is
-- Constants --
DOMAIN constant varchar2(30) := 'provider';
SUBDOMAIN constant varchar2(32) := 'services';
function get_portlet_info
(
p_provider_id in integer
,p_language in varchar2
)
return wwpro_api_provider.portlet_record
is
l_portlet wwpro_api_provider.portlet_record;
begin
-- Perform the Security Check
if not is_runnable(p_provider_id, null)
then
wwerr_api_error.add(DOMAIN, SUBDOMAIN,
'securityerr', 'services_portlet.get_portlet_info');
raise wwpro_api_provider.PROVIDER_SECURITY_EXCEPTION;
end if;
...
end SERVICES_PORTLET;
/
CREATE OR REPLACE
package body SERVICES_PORTLET
is
...
procedure show
(
p_portlet_record wwpro_api_provider.portlet_runtime_record
)
is
l_portlet wwpro_api_provider.portlet_record;begin
-- Perform the Security Checkif not is_runnable(p_provider_id, null)
then
wwerr_api_error.add(DOMAIN, SUBDOMAIN,
'securityerr', 'services_portlet.show');
raise wwpro_api_provider.PROVIDER_SECURITY_EXCEPTION;
end if;
...
if (p_portlet_record.exec_mode = wwpro_api_provider.MODE_SHOW) then
...
elsif (p_portlet_record.exec_mode = wwpro_api_provider.MODE_PREVIEW) then
/*
Display the preview page for the portlet.
*/
...
else
wwerr_api_error.add(DOMAIN, SUBDOMAIN,
'invaliddispmode', 'services_portlet.show');
raise wwpro_api_provider.PROVIDER_EXECUTION_EXCEPTION;
end if;
EXCEPTION
when others then
wwerr_api_error.add(DOMAIN, SUBDOMAIN,
'generalerr', 'services_portlet.show');
raise wwpro_api_provider.PROVIDER_EXECUTION_EXCEPTION;
end show;
end SERVICES_PORTLET;
/
CREATE OR REPLACE
package body SERVICES_PORTLET
is
...
procedure save_prefs
(
...
)
...
return wwpro_api_provider.portlet_record
is
l_portlet wwpro_api_provider.portlet_record;
begin
...
exception
when INVALID_TEXT_EXCEPTION then
...
wwerr_api_error.add(DOMAIN, SUBDOMAIN,
'invalid_text', 'services_portlet.save_prefs');
if (not wwerr_api_error.is_empty) thenwwerr_api_error_ui.show_html;
end if;
end save_prefs;
...
end SERVICES_PORTLET;
/
| Revision History: |
|
| Oracle Corporation World Headquarters 500 Oracle Parkway Redwood Shores, CA 94065, USA http://www.oracle.com/ |
Worldwide Inquiries: 1-800-ORACLE1 Fax 650.506.7200 |
Copyright and Corporate Info |