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

Framework : CATJSystem

Module : CATJSystem

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:

  1. SYSTEM_ERR001 = "Error message";
  2. 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);

See Also:
CATMessageCatalog
CATSession
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

INFO

    int INFO
Severity flag for informative messages.


WARNING

    int WARNING
Severity flag for warning messages.


ERROR

    int ERROR
Severity flag for error messages.


Constructor Detail

CATError

    CATError(String iMsgCatalog, String iMsgId)

Initializes a new instance with a given error identifier and a given message.

Parameters:
iMsgCatalog
the message catalog name in which the message is located
iMsgId
the message identifier (it must be referenced into the catalog file as a key)

CATError

    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.

Parameters:
iFatherError
the source error or exception that has been caught
iMsgCatalog
the message catalog in which the message is located
iMsgId
the message identifier (it must be referenced into the catalog file as a key value)

Method Detail

getFatherError

    Throwable getFatherError()

Returns the source error or exception, if any.

Returns:
the source error, null if not available.

getComponent

    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.

Returns:
the name of the message catalog associated with the current instance.

getMsgId

    String getMsgId()

Returns the error message identifier.

Returns:
the error message identifier (it must be referenced into the catalog file as a key value).

setParameter

    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).

Parameters:
iIndex
the parameter index (must match the value specified in the message catalog)
iValue
the parameter value

getNLSMessage

    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).

Parameters:
iSession
the current session used to retrieved the current locale.
Returns:
the translated message according to the current locale.

getNLSRequest

    String getNLSRequest(CATSession iSession)

Returns the NLS message for "Request", replacing parameters with the values specified, if any.

Parameters:
iSession
the current session used to retrieved the current locale.
Returns:

getNLSDiagnostic

    String getNLSDiagnostic(CATSession iSession)

Returns the NLS message for "Diagnostic", replacing parameters with the values specified, if any.

Parameters:
iSession
the current session used to retrieved the current locale.
Returns:

getNLSAdvice

    String getNLSAdvice(CATSession iSession)

Returns the NLS message for "Advice", replacing parameters with set values.

Parameters:
iSession
the current session used to retrieved the current locale.
Returns:


Copyright © 2000, Dassault Systèmes. All rights reserved