Wednesday, June 10, 2009

Oracle APEX: User friendly exceptions and logging

One of the bug-bears of Oracle Apex has been intercepting unplanned exceptions and displaying a user-friendly message. I've decided to tackle the issue using a little AJAX to capture the error and retrieve a "nice" user-friendly message. It also gives me the opportunity to log the error, as well as relevant session information. Check out Friendly Exception Messages with source code. The code uses Apex built-in javascript, so can be used on any application (no need for ExtJS).

8 comments:

Gerben said...

very, Very, VERY NICE!

ranaguir said...

Hello, I like your custom error page.
I created the template and the process but I don't know how to make APEX use this new template.

I searched in the documentation and google, but it seems everybody knows how to do it, because nobody ask about it.

Can you please explain how integrate this Error Template to an application?

Thanks

Mark Lancaster said...

You set the error template in the Theme> Component Defaults section.

Anonymous said...

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 showing the default message at the top of the page.
It appears to be related to the #BOX_BODY# in the template, but I can't seem to remove it either.

Do you know why this would be? Have I missed anything?

Thank you,
Chand

Mark Lancaster said...

Hi Chand

You will need to set up a demo for me to look at.

newbii said...

Hi Mark, Chand

Did you find a resolution to
the problem of displaying the error page?

I appear to be having a similar problem, having cut and pasted your code into the header, body and footer of the error page and having created the application process "error_handler", and set the Themes Error page.

I still just get the blue error panel at the top of the page and no error table below it.

I am a newbie so am probably doing something silly. I am assuming that the code works as is and does not require any additional software added or configuration. I'm trying it out in the Apex Sample Application to rule out any other code of mine getting in the way...

I am using Apex 3.2.

Any pointers much appreciated..

Kind Regards.
newbii

Mark Lancaster said...

Hi Newbii

If you put up a demo I can look at it, otherwise I can only guess.

After all, my demo works.

Mark

newbii said...

Hi Mark

It's ok. I discovered that the problem was caused by the line in the application process:

select error_log_seq.nextval into l_error_id from dual;

The sequence did not exist.

Kind Regards.
newbii