20.1.6.2 Specifying an Error Handling Function

Define an Error Handling Function to rewrite server-side errors before APEX reports them.

The APEX engine calls your error handling function before reporting any server-side error. When appropriate, your function can change the error message to something more user-friendly. The function can have any name, but it must have the single parameter and return type as shown below. The APEX engine passes it a T_ERROR record, and it returns a T_ERROR_RESULT one. Optionally, define the function in a package like MESSAGES_APP. Then, configure a page to use it by setting the Error Handling Function property of the page to the function's name as shown below.

-- In package messages_app
function apex_error_handling (
    p_error in apex_error.t_error )
    return     apex_error.t_error_result;

Figure 20-20 Configuring a Page's Error Handling Function