ECApplicationException :
This
exception is thrown if the error is related to user input and will always fail.
For example, when a user enters an invalid parameter, an ECApplicationException
is thrown. When this exception is thrown, the solution controller does not
retry the command, even if it is specified as a retriable command.
ECSystemException:
This
exception is thrown if a runtime exception or a Websphere Commerce
configuration error is detected. Examples of this type of exception include
create exceptions, remote exceptions, and other EJB exceptions. When this type
of exception is thrown, the solution controller retries the command if the
command is retriable and the exception was caused by either a database deadlock
or database rollback.
Both of
the exception types are classes that extend from the ECException class, which
is found in the com.ibm.commerce.exception package.
In order
to throw one of these exceptions, the following information must be specified:
Error view name :
The view that will be used to
display the error. For web requests, the web controller looks up this name in
the Struts configuration files.
ECMessage object :
ECMessage defines the static
information related to the reason for the exception. This value corresponds to
the message text contained within a properties file.
ECParameter :
ECParameter returns the errors
associated with the application. The exceptions can indicate multiple errors
since each part of an application exception represent an error.
Exceptions
handling is tightly integrated with the logging system. When a system exception
is thrown, it is automatically logged.
Writing
user own exceptions handling logic involves the following steps:
1. Catching the exceptions in your command
that require special processing.
2. Constructing either an
ECApplicationException or ECSystemException, based upon the type of exception
caught.
3. If the ECApplicationException uses a new
message, defining the message in a new properties file.
Comments
Post a Comment