ErrorException Class Reference

Encapsulates an error. More...

Inherited by CallbackException, DSIException, InvalidCatalogException, InvalidSchemaException, OperationCanceledException, SESqlEngineException, InvalidArgumentException, InvalidOperationException, ProductException, SupportException, and ThreadInterruptException.

List of all members.

Public Member Functions

 ErrorException (SQLState in_customState, simba_int32 in_componentId, const simba_wstring &in_msgKey, const std::vector< simba_wstring > &in_msgParams, simba_signed_native in_rowNum=NO_ROW_NUMBER, simba_int32 in_colNum=NO_COLUMN_NUMBER)
 Constructor.
 ErrorException (SQLState in_customState, simba_int32 in_componentId, const simba_wstring &in_msgKey, simba_signed_native in_rowNum=NO_ROW_NUMBER, simba_int32 in_colNum=NO_COLUMN_NUMBER)
 Constructor.
 ErrorException (bool in_dummy, SQLState in_customState, simba_int32 in_premadeNativeErrCode, const simba_wstring &in_preformattedMsgText, simba_signed_native in_rowNum=NO_ROW_NUMBER, simba_int32 in_colNum=NO_COLUMN_NUMBER)
 Constructor for ErrorException with pre-formatted message and premade native error code.
 ErrorException (DiagState in_stateKey, simba_int32 in_componentId, const simba_wstring &in_msgKey, const std::vector< simba_wstring > &in_msgParams, simba_signed_native in_rowNum=NO_ROW_NUMBER, simba_int32 in_colNum=NO_COLUMN_NUMBER)
 Constructor.
 ErrorException (DiagState in_stateKey, simba_int32 in_componentId, const simba_wstring &in_msgKey, simba_signed_native in_rowNum=NO_ROW_NUMBER, simba_int32 in_colNum=NO_COLUMN_NUMBER)
 Constructor.
 ErrorException (bool in_dummy, DiagState in_stateKey, simba_int32 in_premadeNativeErrCode, const simba_wstring &in_preformattedMsgText, simba_signed_native in_rowNum=NO_ROW_NUMBER, simba_int32 in_colNum=NO_COLUMN_NUMBER)
 Constructor for ErrorException with pre-formatted message and premade native error code.
simba_int32 GetColumnNumber () const
 Returns the column associated with the diagnostic. This value may be NO_COLUMN_NUMBER or COLUMN_NUMBER_UNKNOWN for diagnostics not associated with specific columns.
simba_int32 GetComponentId () const
 Returns the component ID.
SQLState GetCustomState () const
 Returns the custom state.
void GetMessageKeyOrText (simba_wstring &out_msgKeyOrText) const
 Returns the key used to retrieve the diagnostic message from a IMessageSource, or the preformatted message.
const simba_wstringGetMessageKeyOrText () const
 Returns the key used to retrieve the diagnostic message from a IMessageSource, or the preformatted message.
const std::vector
< simba_wstring > * 
GetMessageParams () const
 Returns the parameters used to construct the diagnostic message. The vector will be empty if HasMessageParams() returned false. (NOT OWN).
simba_wstring GetMessageText (SharedPtr< IMessageSource > in_messageSource, const simba_string &in_locale)
 Returns the formatted error message. The message source will be used to construct the message if this exception does not have a preformatted message. If the exception has a preformatted message, in_messageSource may be NULL.
simba_wstring GetMessageText (IMessageSource *in_messageSource, const simba_string &in_locale)
 Returns the formatted error message. The message source will be used to construct the message if this exception does not have a preformatted message. If the exception has a preformatted message, in_messageSource may be NULL.
simba_int32 GetNativeErrorCode (SharedPtr< IMessageSource > in_messageSource, const simba_string &in_locale)
 Returns the native error code.
simba_int32 GetNativeErrorCode (IMessageSource *in_messageSource, const simba_string &in_locale)
 Returns the native error code.
simba_signed_native GetRowNumber () const
 Returns the row associated with the diagnostic. This value may be NO_ROW_NUMBER or ROW_NUMBER_UNKNOWN for diagnostics not associated with specific rows.
DiagState GetStateKey () const
 Returns the diagnostic state.
bool HasCustomState () const
 Indicates whether or not the exception has a custom SQLSTATE, which can be retrieved using GetCustomState().
bool HasMessageParams () const
 Indicates whether the diagnostic carries parameters that will be used to construct the associated message.
bool HasPreformattedMessage () const
 Indicates whether or not the exception already has a pre-formatted message, which can be retrieved using GetMessageKeyOrText().
void SetColumnNumber (simba_int32 in_columnNumber)
 Set the column number if it is not already set.
void SetRowNumber (simba_signed_native in_rowNumber)
 Set the row number.
simba_wstring ToString () const
 Returns a string description of this object.
virtual ~ErrorException ()
 Destructor.

Static Public Member Functions

static ErrorException GetCurrentExceptionAsErrorException (simba_int32 in_nativeErrorCode=0)
 Get the current exception as an ErrorException. (Must be within a catch block).
static simba_wstring GetCurrentExceptionMessage (SharedPtr< IMessageSource > in_messageSource, const simba_string &in_locale)
 Get an error message from the current exception. (Must be within a catch block).
static simba_wstring GetCurrentExceptionMessage (IMessageSource *in_messageSource, const simba_string &in_locale)
 Get an error message from the current exception. (Must be within a catch block).
static void LogCurrentException (ILogger &in_logger, const char *in_namespace, const char *in_class, const char *in_function)
 Log an exception which occurred. (Must be within a catch block).

Protected Member Functions

void SetStateKey (DiagState in_stateKey)
 Sets the diagnostic state.

Detailed Description

Encapsulates an error.


Constructor & Destructor Documentation

ErrorException ( bool  in_dummy,
DiagState  in_stateKey,
simba_int32  in_premadeNativeErrCode,
const simba_wstring in_preformattedMsgText,
simba_signed_native  in_rowNum = NO_ROW_NUMBER,
simba_int32  in_colNum = NO_COLUMN_NUMBER 
)

Constructor for ErrorException with pre-formatted message and premade native error code.

Parameters:
in_dummy Used to differentiate pre-formatted message constructor.
in_stateKey Type of error.
in_premadeNativeErrCode Native error code.
in_preformattedMsgText Error message text.
in_rowNum Row for the error. May be a non-negative integer, NO_ROW_NUMBER, or ROW_NUMBER_UNKNOWN.
in_colNum Column for the error. May be a non-negative integer, NO_COLUMN_NUMBER, or COLUMN_NUMBER_UNKNOWN.
ErrorException ( DiagState  in_stateKey,
simba_int32  in_componentId,
const simba_wstring in_msgKey,
simba_signed_native  in_rowNum = NO_ROW_NUMBER,
simba_int32  in_colNum = NO_COLUMN_NUMBER 
)

Constructor.

Parameters:
in_stateKey Type of error.
in_componentId Source component.
in_msgKey Key into IMessageSource for the error message.
in_rowNum Row for the error. May be a non-negative integer, NO_ROW_NUMBER, or ROW_NUMBER_UNKNOWN.
in_colNum Column for the error. May be a non-negative integer, NO_COLUMN_NUMBER, or COLUMN_NUMBER_UNKNOWN.
ErrorException ( DiagState  in_stateKey,
simba_int32  in_componentId,
const simba_wstring in_msgKey,
const std::vector< simba_wstring > &  in_msgParams,
simba_signed_native  in_rowNum = NO_ROW_NUMBER,
simba_int32  in_colNum = NO_COLUMN_NUMBER 
)

Constructor.

Parameters:
in_stateKey Type of error.
in_componentId Source component ID.
in_msgKey Key into IMessageSource for the error message.
in_msgParams Parameters to be used to construct the error message.
in_rowNum Row for the error. May be a non-negative integer, NO_ROW_NUMBER, or ROW_NUMBER_UNKNOWN.
in_colNum Column for the error. May be a non-negative integer, NO_COLUMN_NUMBER, or COLUMN_NUMBER_UNKNOWN.
ErrorException ( bool  in_dummy,
SQLState  in_customState,
simba_int32  in_premadeNativeErrCode,
const simba_wstring in_preformattedMsgText,
simba_signed_native  in_rowNum = NO_ROW_NUMBER,
simba_int32  in_colNum = NO_COLUMN_NUMBER 
)

Constructor for ErrorException with pre-formatted message and premade native error code.

Parameters:
in_dummy Used to differentiate pre-formatted message constructor.
in_customState SQLSTATE of the error. (Should be 5 characters long)
in_premadeNativeErrCode Native error code.
in_preformattedMsgText Error message text.
in_rowNum Row for the error. May be a non-negative integer, NO_ROW_NUMBER, or ROW_NUMBER_UNKNOWN.
in_colNum Column for the error. May be a non-negative integer, NO_COLUMN_NUMBER, or COLUMN_NUMBER_UNKNOWN.
ErrorException ( SQLState  in_customState,
simba_int32  in_componentId,
const simba_wstring in_msgKey,
simba_signed_native  in_rowNum = NO_ROW_NUMBER,
simba_int32  in_colNum = NO_COLUMN_NUMBER 
)

Constructor.

Parameters:
in_customState SQLSTATE of the error. (Should be 5 characters long)
in_componentId Source component.
in_msgKey Key into IMessageSource for the error message.
in_rowNum Row for the error. May be a non-negative integer, NO_ROW_NUMBER, or ROW_NUMBER_UNKNOWN.
in_colNum Column for the error. May be a non-negative integer, NO_COLUMN_NUMBER, or COLUMN_NUMBER_UNKNOWN.
ErrorException ( SQLState  in_customState,
simba_int32  in_componentId,
const simba_wstring in_msgKey,
const std::vector< simba_wstring > &  in_msgParams,
simba_signed_native  in_rowNum = NO_ROW_NUMBER,
simba_int32  in_colNum = NO_COLUMN_NUMBER 
)

Constructor.

Parameters:
in_customState SQLSTATE of the error. (Should be 5 characters long)
in_componentId Source component ID.
in_msgKey Key into IMessageSource for the error message.
in_msgParams Parameters to be used to construct the error message.
in_rowNum Row for the error. May be a non-negative integer, NO_ROW_NUMBER, or ROW_NUMBER_UNKNOWN.
in_colNum Column for the error. May be a non-negative integer, NO_COLUMN_NUMBER, or COLUMN_NUMBER_UNKNOWN.
virtual ~ErrorException (  )  [virtual]

Destructor.


Member Function Documentation

simba_int32 GetColumnNumber (  )  const

Returns the column associated with the diagnostic. This value may be NO_COLUMN_NUMBER or COLUMN_NUMBER_UNKNOWN for diagnostics not associated with specific columns.

simba_int32 GetComponentId (  )  const

Returns the component ID.

static ErrorException GetCurrentExceptionAsErrorException ( simba_int32  in_nativeErrorCode = 0  )  [static]

Get the current exception as an ErrorException. (Must be within a catch block).

If the current exception _is_ an ErrorException (or subclass), it returns a copy. Otherwise, it returns a preformatted ErrorException whose error message is retrieved from the current exception.

in_nativeErrorCode The native error code to use for the generated ErrorException (if the current exception was not an ErrorException).

static simba_wstring GetCurrentExceptionMessage ( SharedPtr< IMessageSource in_messageSource,
const simba_string in_locale 
) [static]

Get an error message from the current exception. (Must be within a catch block).

Parameters:
in_messageSource The message source to use to formate any ErrorExceptions. If NULL, then no formatting of ErrorExceptions will be done; instead ErrorException::ToString() will be used. (NOT OWN)
in_locale The locale to use to format any ErrorExceptions.
Returns:
The error message.
static simba_wstring GetCurrentExceptionMessage ( IMessageSource in_messageSource,
const simba_string in_locale 
) [static]

Get an error message from the current exception. (Must be within a catch block).

Parameters:
in_messageSource The message source to use to formate any ErrorExceptions. If NULL, then no formatting of ErrorExceptions will be done; instead ErrorException::ToString() will be used. (NOT OWN)
in_locale The locale to use to format any ErrorExceptions.
Returns:
The error message.
SQLState GetCustomState (  )  const

Returns the custom state.

void GetMessageKeyOrText ( simba_wstring out_msgKeyOrText  )  const

Returns the key used to retrieve the diagnostic message from a IMessageSource, or the preformatted message.

Parameters:
out_msgKeyOrText 
const simba_wstring& GetMessageKeyOrText (  )  const

Returns the key used to retrieve the diagnostic message from a IMessageSource, or the preformatted message.

Returns:
Message key or text.
const std::vector<simba_wstring>* GetMessageParams (  )  const

Returns the parameters used to construct the diagnostic message. The vector will be empty if HasMessageParams() returned false. (NOT OWN).

simba_wstring GetMessageText ( SharedPtr< IMessageSource in_messageSource,
const simba_string in_locale 
)

Returns the formatted error message. The message source will be used to construct the message if this exception does not have a preformatted message. If the exception has a preformatted message, in_messageSource may be NULL.

Parameters:
in_messageSource 
in_locale The locale.
Returns:
simba_wstring GetMessageText ( IMessageSource in_messageSource,
const simba_string in_locale 
)

Returns the formatted error message. The message source will be used to construct the message if this exception does not have a preformatted message. If the exception has a preformatted message, in_messageSource may be NULL.

Parameters:
in_messageSource (NOT OWN)
in_locale The locale.
Returns:
simba_int32 GetNativeErrorCode ( SharedPtr< IMessageSource in_messageSource,
const simba_string in_locale 
)

Returns the native error code.

Parameters:
in_messageSource The message source.
in_locale The locale.
simba_int32 GetNativeErrorCode ( IMessageSource in_messageSource,
const simba_string in_locale 
)

Returns the native error code.

Parameters:
in_messageSource The message source.(NOT OWN)
in_locale The locale.
simba_signed_native GetRowNumber (  )  const

Returns the row associated with the diagnostic. This value may be NO_ROW_NUMBER or ROW_NUMBER_UNKNOWN for diagnostics not associated with specific rows.

DiagState GetStateKey (  )  const

Returns the diagnostic state.

bool HasCustomState (  )  const

Indicates whether or not the exception has a custom SQLSTATE, which can be retrieved using GetCustomState().

bool HasMessageParams (  )  const

Indicates whether the diagnostic carries parameters that will be used to construct the associated message.

bool HasPreformattedMessage (  )  const

Indicates whether or not the exception already has a pre-formatted message, which can be retrieved using GetMessageKeyOrText().

static void LogCurrentException ( ILogger in_logger,
const char *  in_namespace,
const char *  in_class,
const char *  in_function 
) [static]

Log an exception which occurred. (Must be within a catch block).

Parameters:
in_logger The logger to log to. (NOT OWN)
in_namespace The namespace of the function attempting to log. (NOT OWN)
in_class The name of the class to log. (NOT OWN)
in_function The name of the function to log. (NOT OWN)
void SetColumnNumber ( simba_int32  in_columnNumber  ) 

Set the column number if it is not already set.

In other words, if the column number is already set, this call will have no effect to make sure the original column number is preserved.

Parameters:
in_columnNumber The number of the column in which the exception occurs.
void SetRowNumber ( simba_signed_native  in_rowNumber  ) 

Set the row number.

In other words, if the row number is already set, this call will have no effect to make sure the original row number is preserved.

Parameters:
in_rowNumber The number of the row in which the exception occurs.
void SetStateKey ( DiagState  in_stateKey  )  [protected]

Sets the diagnostic state.

Parameters:
in_stateKey 
simba_wstring ToString (  )  const

Returns a string description of this object.

If this object already has a pre-formatted message, this method is equivalent to GetMessageKeyOrText(). Otherwise, this will return a description of the exception, including the message key, component ID, State key/Custom SQL State, and message parameters, if there are any.

The format of the returned string is unspecified; it is meant for logging/display purposes if there is no message source available.

Returns:
A string description of this object.

The documentation for this class was generated from the following file:

Generated on Wed May 17 14:21:18 2017 for SimbaEngine 10.1.3.1011 by simba