Loading...
Mark´s Playpen Integrating ExtJS javascript library with Oracle Application Express
APEX_PUBLIC_USER
Value
Rows Displayed
Raise an Exception   

To show the error page, choose an exception from the list.


Error Page Template
Value
TEMPLATE_NAME
Error Template
HEADER_TEMPLATE
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <head> #HEAD# <!-- standard stylesheets --> <style type="text/css"> body {background-color:#FFFFFF;height:auto;margin:5px;} #error-box {-x-system-font:none;background:#DFE8F6 none repeat scroll 0 0;border:1px dotted #99BBE8;margin:5px auto;padding:5px;width:600px;text-align:left;} #error-box, #error-box td {color:#EE0000;font-family:tahoma,arial,sans-serif;font-size:11px;} #ajax-drop {width:600px;margin:5px auto;text-align:left;} .err-table {border:1px solid #99BBE8;border-collapse:collapse;margin-top:6px;empty-cells:show;width:100%} .err-table th {font:bold 11px arial,tahoma,helvetica,sans-serif; padding:4 11 4 4px;text-align:left; background:#F9F9F9 url(&EXT_PATH.resources/images/default/grid/grid3-hrow.gif) } .err-table td {font:normal 11px arial,tahoma,helvetica,sans-serif; padding:4 11 4 4px;text-align:left; border-top:1px solid beige; } hr {border: 0;color: #8DB2E3;background-color:#8DB2E3;height:1px;width:100%;text-align:left;} </style> </head> <body onLoad="getErrorMessage();"> #FORM_OPEN#
PAGE_BODY
<div align="center"> <div id="error-box">#BOX_BODY#</div> <div id="ajax-drop"> </div> </div>
FOOTER_TEMPLATE
#FORM_CLOSE# <script type="text/javascript"> function getErrorMessage(){ // call ondemand application process, aysyncronously execute passed javascript function when done var lRequest = new apex.ajax.ondemand('error_handler', function(){ var l_s = p.readyState; if(l_s == 1||l_s == 2||l_s == 3){ }else if(l_s == 4){ gReturn = p.responseText; $s('ajax-drop',gReturn); }else{return false;} } ); // select error message by class var els = getElementsByClass('ErrorPageMessage',null,'DIV'); if (els.length > 0) { // populate parameters we are passing lRequest.ajax.addParam('x01',els[0].innerHTML); lRequest.ajax.addParam('x02','&APP_PAGE_ID.'); lRequest.ajax.addParam('x03','&REQUEST.'); // display a spinner while waiting $s('ajax-drop','<div align="center"><img src="/i/ws/ajax-loader.gif" /></div>'); // execute our request lRequest._get(); } } </script> </body> </html>
Application Process
Value
PROCESS_NAME
error_handler
PROCESS_POINT
On Demand: Run this application process when requested by a page process
PROCESS
declare l_error_id number; l_error_message varchar2(4000); begin -- generate an error number to pass back to the user select error_log_seq.nextval into l_error_id from dual; -- lookup a friendly error message based on the error message passed -- (you can split out the ORA-xxxxxx number) -- just "simulate" the lookup here l_error_message := 'Here is a really user-friendly message I looked up using the info passed by the Application Process.'; -- display the friendly message htp.p(l_error_message); htp.p('Quote <span style="color:red">ERR-'|| to_char(l_error_id,'FM00000') ||'</span> to your support group if you believe this is a genuine error.'); -- info passed htp.p('<hr />'); htp.p('<table class="err-table">'); htp.p('<tr><th colspan="3">Application Process was passed:</th></tr>'); htp.p('<tr><th>AJAX variable</th><th>Contains</th><th>Value</th></tr>'); htp.p('<tr><td>wwv_flow.g_x01</td><td>Error Message</td><td>'|| wwv_flow.g_x01||'</td></tr>'); htp.p('<tr><td>wwv_flow.g_x02</td><td>APP_PAGE_ID</td><td>' || wwv_flow.g_x02||'</td></tr>'); htp.p('<tr><td>wwv_flow.g_x03</td><td>REQUEST</td><td>' || wwv_flow.g_x03||'</td></tr>'); htp.p('</table>'); htp.p('<br />'); -- info we can reference htp.p('<table class="err-table">'); htp.p('<tr><th colspan="2">Data you may want to capture when error logging:</th></tr>'); htp.p('<tr><th>Substitution String</th><th>Value</th></tr>'); htp.p('<tr><td>APP_ID</td><td>' || v('APP_ID') ||'</td></tr>'); htp.p('<tr><td>APP_PAGE_ID (wwv_flow.g_x02)</td><td>' || wwv_flow.g_x02 ||'</td></tr>'); htp.p('<tr><td>APP_SESSION</td><td>' || v('APP_SESSION') ||'</td></tr>'); htp.p('<tr><td>APP_USER</td><td>' || v('APP_USER') ||'</td></tr>'); htp.p('<tr><td>REQUEST (wwv_flow.g_x03)</td><td>' || wwv_flow.g_x03 ||'</td></tr>'); htp.p('<tr><th>Page Item</th><th>Value</th></tr>'); for rec in (select pg.item_name from apex_application_page_items pg where pg.application_id = nv('APP_ID') and pg.page_id in (0,to_number(wwv_flow.g_x02)) order by pg.page_id desc, pg.display_sequence ) loop htp.p('<tr><td>'||rec.item_name||'</td><td>' || v(rec.item_name) || '</td></tr>'); end loop; htp.p('</table>'); end;
Page Comments

Author Comment
anonGreat stuff​
testtest comment
a
ghh ​dfh dfh df h  
Chand​Hi mark,
  Thank you for your help in sorting out the error messages.

   I have followed your steps and created the template and the process. However, when I hit an error, even though it is displaying my error page, it is also however showing the default message at the top of the page.  Do you know why this would be?  Have I missed anything? 

Thank you,
Chand
  cvxcvvxcvxzcxzcxzcxz
klkkk kklklklklklkl
TonyNicely done.  Providing the session state information is great - this helps with debugging, plus users never can tell you how they got the error.
VikasVery useful, thanks a lot!
Page Ref: 200801:2028
Generate: 0.12
  Release 1.0
©2008 Mark Lancaster. All rights reserved.
ExtJs