All Frameworks  Class Hierarchy  This Framework  Previous  Next  Indexes

System Exception CATError

System.IUnknown
  |
  +---System.IDispatch
    |
    +---System.CATBaseUnknown
      |
      +---CATError
 

Usage: you can derive this class.


public class CATError

Base class for errors.
Role: You cannot instantiate this class. Derive it to create your own error class that refines the type of managed errors using CATDeclareError and CATImplementError macros.


Constructor and Destructor Index


o CATError(char*,char*)
Constructs an error with a given error identifier and a given message.
o ~CATError()

Method Index


o CATCleanLastError()
Cleans the last returned error.
o CATGetLastError(HRESULT,IUnknown*)
Returns a pointer to the last error class instance.
o CATSetLastError(IUnknown*)
Sets the error to return.
o GetId()
Returns the error identifier.
o GetInformationOnErrorType()
Returns the error type.
o GetMsgCatalog()
Returns the error message catalog file name.
o GetMsgId()
Returns the error message key.
o GetNLSAdvice()
Returns the Advice part of the error message.
o GetNLSDiagnostic()
Returns the Diagnostic part of the error message.
o GetNLSMessage()
Returns the error message.
o GetNLSRequest()
Returns the Request part of the error message.
o GetNLSSource()
Returns the error source.
o GetReturnCode()
Returns the error return code for error propagation.
o GetSourceContext(char**)
Retrieves the source context.
o GetSourceFileName(char**)
Retrieves the source file path name where the error occurs.
o GetSourceLineNumber(int*)
Retrieves the line number in the source file where the error occurs.
o SetInformationOnErrorType(CATErrorType)
Sets the error type.
o SetNLSAdviceParams(int,CATUnicodeString*,...)
Sets the values of the Advice part of the error message parameters.
o SetNLSDiagnosticParams(int,CATUnicodeString*,...)
Sets the values of the Diagnostic part of the error message parameters.
o SetNLSParameters(int,CATUnicodeString*,...)
Sets the values of the error message parameters.
o SetNLSRequestParams(int,CATUnicodeString*,...)
Sets the values of the Request part of the error message parameters.
o SetReturnCode(HRESULT)
Sets the error return code for error propagation.
o SetSourceContext(char*)
Sets the source context.
o SetSourceFileName(char*)
Sets the source file path name where the error occurs.
o SetSourceLineNumber(int)
Sets the line number in the source file where the error occurs.

Constructor and Destructor


o CATError
public CATError( const char* iMsgId,
const char* iMsgCatalog)
Constructs an error with a given error identifier and a given message.
Parameters:
iMsgId
The message key
iMsgCatalog
The message catalog in which the message is located
o ~CATError
public virtual ~CATError()

Methods


o CATCleanLastError
public static void CATCleanLastError()
Cleans the last returned error.
Role: Deletes the last returned error instance and cleans the error manager.
o CATGetLastError
public static CATError* CATGetLastError(HRESULT iHR,
IUnknown* iInterfaces= NULL )
Returns a pointer to the last error class instance.
Parameters:
iHR
The return code of the method in error
iInterfaces
The pointer to the interface used to call the method in error.
Legal values: Set it to NULL in case of non-distribution, and to the interface pointer used to call the method otherwise.
o CATSetLastError
public void CATSetLastError(IUnknown* iInterfaces= NULL )
Sets the error to return.
Role: Once you have created the error class instance in the method in error, use CATSetLastError to pass it to the error manager. The error can then be retrieved by the caller using CATGetLastError
Parameters:
iInterfaces

Legal values: Set it always to NULL
o GetId
public virtual CATErrorId GetId()
Returns the error identifier.
o GetInformationOnErrorType
public virtual CATErrorType GetInformationOnErrorType()
Returns the error type.
o GetMsgCatalog
public virtual const char * GetMsgCatalog()
Returns the error message catalog file name.
o GetMsgId
public virtual const char * GetMsgId()
Returns the error message key.
o GetNLSAdvice
public virtual CATUnicodeString GetNLSAdvice()
Returns the Advice part of the error message.
o GetNLSDiagnostic
public virtual CATUnicodeString GetNLSDiagnostic()
Returns the Diagnostic part of the error message.
o GetNLSMessage
public virtual CATUnicodeString GetNLSMessage()
Returns the error message.
Role: The three parts Request, Diagnostic, and Advice of the error message are returned concatenated in a single message.
o GetNLSRequest
public virtual CATUnicodeString GetNLSRequest()
Returns the Request part of the error message.
o GetNLSSource
public virtual CATUnicodeString GetNLSSource()
Returns the error source.
Role: The error source is made of the concatenation of: They are separated with the "-" (dash) character.
Example: CATIA - SystemError - KeyRangeERR_3000
o GetReturnCode
public virtual HRESULT GetReturnCode()
Returns the error return code for error propagation.
Legal values: Valid HRESULT values.
o GetSourceContext
public virtual HRESULT GetSourceContext(char** ocontext)
Retrieves the source context.
Role: The source context is the name of the application that issues the error.
Parameters:
ocontext
The source context.
Legal values: It is CATIA by default.
Returns:
An HRESULT.
S_OK
The source context is successively retrieved
E_FAIL
The source context can't be retrieved
o GetSourceFileName
public virtual HRESULT GetSourceFileName(char** oFile)
Retrieves the source file path name where the error occurs.
Parameters:
oFile
The source file path name.
Lifecycle rules deviation: Do not delete this pointer.
Returns:
An HRESULT.
S_OK
The source file path name is successively retrieved
E_FAIL
The source file path name can't be retrieved
o GetSourceLineNumber
public virtual HRESULT GetSourceLineNumber(int* oLine)
Retrieves the line number in the source file where the error occurs.
Parameters:
oLine
The line number
Returns:
An HRESULT.
S_OK
The line number is successively retrieved
E_FAIL
The line number can't be retrieved
o SetInformationOnErrorType
public virtual HRESULT SetInformationOnErrorType(CATErrorType iErrorType)
Sets the error type.
Parameters:
iErrorType
The error type to set to the error
o SetNLSAdviceParams
public virtual void SetNLSAdviceParams(int iNumNLSParam,
CATUnicodeString* iUS1,
... )
Sets the values of the Advice part of the error message parameters.
Role: The Advice part of error message can contain parameters that are valued at run time when the error occurs. Their values must first be converted as CATUnicodeString instances. This method has a variable number of parameters to match the error message parameter number.
Parameters:
iNumNLSParam
The number of parameters of the error message
iUS1
The first parameter value converted as a CATUnicodeString instance
o SetNLSDiagnosticParams
public virtual void SetNLSDiagnosticParams(int iNumNLSParam,
CATUnicodeString* iUS1,
... )
Sets the values of the Diagnostic part of the error message parameters.
Role: The Diagnostic part of error message can contain parameters that are valued at run time when the error occurs. Their values must first be converted as CATUnicodeString instances. This method has a variable number of parameters to match the error message parameter number.
Parameters:
iNumNLSParam
The number of parameters of the error message
iUS1
The first parameter value converted as a CATUnicodeString instance
o SetNLSParameters
public virtual void SetNLSParameters(int iNumNLSParam,
CATUnicodeString* iUS1,
... )
Sets the values of the error message parameters.
Role: The error message can contain parameters that are valued at run time when the error occurs. Their values must first be converted as CATUnicodeString instances. This method has a variable number of parameters to match the error message parameter number. Use this method for a non-composite error message, that is, an error message without Request, Diagnostic, and Advice parts.
Parameters:
iNumNLSParam
The number of parameters of the error message
iUS1
The first parameter value converted as a CATUnicodeString instance
o SetNLSRequestParams
public virtual void SetNLSRequestParams(int iNumNLSParam,
CATUnicodeString* iUS1,
... )
Sets the values of the Request part of the error message parameters.
Role: The Request part of error message can contain parameters that are valued at run time when the error occurs. Their values must first be converted as CATUnicodeString instances. This method has a variable number of parameters to match the error message parameter number.
Parameters:
iNumNLSParam
The number of parameters of the error message
iUS1
The first parameter value converted as a CATUnicodeString instance
o SetReturnCode
public virtual void SetReturnCode(HRESULT iHRESULTCode)
Sets the error return code for error propagation.
Role: Replaces the default return code (E_FAIL). This return code is used when the error needs to be propagated, that is, when the method in error returns using the CATReturnError macro.
Parameters:
iHRESULTCode
The error code.
Legal values: It must be a valid HRESULT value.
o SetSourceContext
public virtual HRESULT SetSourceContext(char* icontext)
Sets the source context.
Role: The source context is the name of the application that issues the error. It is CATIA by default.
Parameters:
icontext
The source context
Returns:
An HRESULT.
S_OK
The source context is successively set
E_FAIL
The source context can't be set
o SetSourceFileName
public virtual HRESULT SetSourceFileName(char* iFile)
Sets the source file path name where the error occurs.
Parameters:
iFile
The source file path name
Returns:
An HRESULT.
S_OK
The source file path name is successively set
E_FAIL
The source file path name can't be set
o SetSourceLineNumber
public virtual HRESULT SetSourceLineNumber(int iLine)
Sets the line number in the source file where the error occurs.
Parameters:
iLine
The line number
Returns:
An HRESULT.
S_OK
The source file path name is successively set
E_FAIL
The source file path name can't be set

This object is included in the file: CATError.h
If needed, your Imakefile.mk should include the module: JS0GROUP

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