Error Handling

Hi rmg,

I am invoking one service through dsp page. I have configured output templete for the service so that I can view the output in my browser. If the service works fine, then I am getting proper result.

If there’s an error while executing the service, I want to display the error message in my web page as well. What I need to add in my output template.

Please Help…

Take a look at the DSP and Output Template Developer’s Guide.

  • Percio

Here is one approach that may get you going.

You could have your service return two additional variables:
(1) returnCode, and
(2) errorMessage.

And if the service is successful, returnCode is set to zero; otherwise, it is set to some non-zero number and errorMessage is set to hold some error message. You would capture any exceptions and set these variables instead of letting the exception percolate up.

Then the output template could invoke a dsp, passing it the returnCode and errorMessage (and any other variables you want), and then in the dsp, use something like this:

%ifvar returnCode equals(‘0’)%
[display some success message]
%value errorMessage%

Optionally, you could surround the errorMessage in the else leg with a HTML tag to make it bold and/or red or whatever you want to make it show up differently.

I’m sure there are other approaches. But hopefully this will help.