System Exception 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 and 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 iMsgId,
const 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 CATCleanLastError()
Cleans the last returned error.
Role: Deletes the last returned error instance and cleans the error manager.
o CATGetLastError
public static CATGetLastError( iHR,
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 CATSetLastError( 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
Parameters:
iInterfaces

Legal values: Set it always to NULL
o GetId
public virtual GetId()
Returns the error identifier.
o GetInformationOnErrorType
public virtual GetInformationOnErrorType()
Returns the error type.
o GetMsgCatalog
public virtual GetMsgCatalog()
Returns the error message catalog file name.
o GetMsgId
public virtual GetMsgId()
Returns the error message key.
o GetNLSAdvice
public virtual GetNLSAdvice()
Returns the Advice part of the error message.
o GetNLSDiagnostic
public virtual GetNLSDiagnostic()
Returns the Diagnostic part of the error message.
o GetNLSMessage
public virtual 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 GetNLSRequest()
Returns the Request part of the error message.
o GetNLSSource
public virtual 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 GetReturnCode()
Returns the error return code for error propagation.
Legal values: Valid HRESULT values.
o GetSourceContext
public virtual GetSourceContext( 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 GetSourceFileName( 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 GetSourceLineNumber( 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 SetInformationOnErrorType( iErrorType)
Sets the error type.
Parameters:
iErrorType
The error type to set to the error
o SetNLSAdviceParams
public virtual SetNLSAdviceParams( iNumNLSParam,
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 SetNLSDiagnosticParams( iNumNLSParam,
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 SetNLSParameters( iNumNLSParam,
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 SetNLSRequestParams( iNumNLSParam,
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 SetReturnCode( 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 macro.
Parameters:
iHRESULTCode
The error code.
Legal values: It must be a valid HRESULT value.
o SetSourceContext
public virtual SetSourceContext( 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 SetSourceFileName( 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 SetSourceLineNumber( 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 © 1999-2015, Dassault Systèmes. All rights reserved.