|
|
Package com.dassault_systemes.catjsystem |
Class CATError
|
Class Hierarchy |
java.lang.Object | +-java.lang.Throwable | +-java.lang.Exception | +-com.dassault_systemes.catjsystem.CATError
Class Location |
Class Description |
public class CATError
An object that enables error handling with internationalization capabilities.
This object can be used to wrap low level errors or exceptions that occur within the application.
Error messages can be defined inside a message catalog using one of the combination described below:
SYSTEM_ERR001 = "Error message";
SYSTEM_ERR001.Request = "Error request message";
SYSTEM_ERR001.Diagnostic = "Error diagnostic message";
SYSTEM_ERR001.Advice = "Error advice message";
When using the second approach combined with a call to the
getNLSMessage(CATSession)
method, the '.Request', '.Diagnostic'
and '.Advice' messages are computed together and split on different lines.
They can still be accessed separately using the following methods:
getNLSRequest(CATSession)
, getNLSDiagnostic(CATSession)
and getNLSAdvice(CATSession)
.
Parameters can be defined inside message strings, and their values can
be later specified in the code using the following method:
setParameter(int, String)
.
Here follows an example of parameter definition inside a message catalog:
SYSTEM_ERR001.Request = "Error while loading file /p1";
Before displaying or throwing the error message described above, the
parameter value should be set programmatically as described below:
error.setParameter(1, fileName);
Field Summary |
int | INFO |
int | WARNING |
int | ERROR |
Constructor Summary |
CATError(String iMsgCatalog, String iMsgId) |
CATError(Throwable iFatherError, String iMsgCatalog, String iMsgId) |
Method Summary |
Throwable | getFatherError() |
String | getComponent() |
String | getMsgId() |
void | setParameter(int iIndex, String iValue) |
String | getNLSMessage(CATSession iSession) |
String | getNLSRequest(CATSession iSession) |
String | getNLSDiagnostic(CATSession iSession) |
String | getNLSAdvice(CATSession iSession) |
Field Detail |
int INFOSeverity flag for informative messages.
int WARNINGSeverity flag for warning messages.
int ERRORSeverity flag for error messages.
Constructor Detail |
CATError(String iMsgCatalog, String iMsgId)Initializes a new instance with a given error identifier and a given message.
iMsgCatalog
iMsgId
CATError(Throwable iFatherError, String iMsgCatalog, String iMsgId)Initializes a new instance with a given error identifier and a given message. This constructor can be used to provide the source error or exception that may have been caught and wrap it into the current instance.
iFatherError
iMsgCatalog
iMsgId
Method Detail |
Throwable getFatherError()Returns the source error or exception, if any.
String getComponent()Returns the name of the message catalog associated with the current instance. The name of this catalog is considered to describe the name of the source 'component' where the error occured. It is a logical concept and will only be accurate if the name of the message catalog has been set accordingly.
String getMsgId()Returns the error message identifier.
void setParameter(int iIndex, String iValue)Provides a parameter value that will be used when computing the error message (see class documentation for details on this topic).
iIndex
iValue
String getNLSMessage(CATSession iSession)Returns the error message in the current locale. The message is split into several lines if either the '.Request', '.Diagnostic' or '.Advice' suffixes have been appended to the message identifier specified inside the input message catalog (see class documentation for details on this topic).
iSession
String getNLSRequest(CATSession iSession)Returns the NLS message for "Request", replacing parameters with the values specified, if any.
iSession
String getNLSDiagnostic(CATSession iSession)Returns the NLS message for "Diagnostic", replacing parameters with the values specified, if any.
iSession
String getNLSAdvice(CATSession iSession)Returns the NLS message for "Advice", replacing parameters with set values.
iSession