Discussion:
Custom error handling
(too old to reply)
D. Portier
2007-01-03 19:49:31 UTC
Permalink
Hello,

I have implemented the interface
com.ibm.commerce.fulfillment.commands.CheckInventoryCmd to have a custom
inventory check.
This check is done on a legacy system and provides some alternatives if the
there ain't enough inventory. If that's the case I throw a subclass
of EcApplicationException. On this subclass there is a method by which i can
access the different alternatives.

I thought this behaviour is justified. As long as i directly call the
checkinventory task command it behaves as espected, however if
the task is called inderectly - e.g via the orderitemaddcmd or
orderitemupdatecmd - then I receive an EcSystemException! This way I can
not access the alternatives.

My question is, how can should I handle the inavaliability properly so that
my ultimate client can access the the alternatives provided by
the backend system?

Daniel Portier
geo
2007-01-06 21:31:09 UTC
Permalink
I am not quite sure I understand. But here goes...

I like the use of subclassed exception, but you would have to also handle
the exception in the other areas that invoke the checkinventorycommand.

This probably requires some more retooling to do something like throwing a
different ECSystemException for each one and then displaying the appropriate
information for the additional options, or could even initiate another
request response cycle with the backend.
if (a)
throw new ECSystemException(
MyConstants._ERR_AINT_NO_MORE_OPTIONA, this
.getClass().getName(), "checkUpdateInventory");
if (b)

throw new ECSystemException(
MyConstants._ERR_AINT_NO_MORE_OPTIONB, this
.getClass().getName(), "checkUpdateInventory");


when your inventory check fails

If instead you need to initiate other behaviour put the databeans required
into the response and change the downstream jsp page to use them to display
the other options. Then you can throw which ever parent exception you wish
and receive the error code in the downstream jsp and produce the correct
customer output from the combination of the error code and the expected
databeans for that error condition.
Post by D. Portier
Hello,
I have implemented the interface
com.ibm.commerce.fulfillment.commands.CheckInventoryCmd to have a custom
inventory check.
This check is done on a legacy system and provides some alternatives if
the there ain't enough inventory. If that's the case I throw a subclass
of EcApplicationException. On this subclass there is a method by which i
can access the different alternatives.
I thought this behaviour is justified. As long as i directly call the
checkinventory task command it behaves as espected, however if
the task is called inderectly - e.g via the orderitemaddcmd or
orderitemupdatecmd - then I receive an EcSystemException! This way I can
not access the alternatives.
My question is, how can should I handle the inavaliability properly so
that my ultimate client can access the the alternatives provided by
the backend system?
Daniel Portier
Loading...