Views
Data Access Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Public Types | Public Member Functions | Static Public Member Functions
IliErrorMessage Class Reference

Error Class. More...

#include <ilviews/dataccess/error.h>

Public Types

enum  Origin {
  UnknownOrigin, DbmsServer, DbmsClientAPI, DbLink,
  DataAccess, Application
}
 The origin of the message. More...
 
enum  Severity { NotAnError, Warning, Error }
 The severity of the message. More...
 

Public Member Functions

 IliErrorMessage ()
 This constructor initializes an undefined error message.
 
 IliErrorMessage (const IliErrorMessage &)
 This constructor copies an error message.
 
 IliErrorMessage (Severity severity, Origin origin, IlInt code, const char *message)
 This constructor initializes an error message. More...
 
IlInt getCode () const
 Returns the error code of the error message. More...
 
const char * getMessage () const
 Returns the descriptive message of the error. More...
 
Origin getOrigin () const
 Returns the origin of the error message. More...
 
Severity getSeverity () const
 Returns the severity of the error message. More...
 
IlBoolean isAnError () const
 Returns IlTrue if the severity of the error message is Error. More...
 
IlBoolean isAWarning () const
 Returns IlTrue if the severity of the error message is Warning. More...
 
IlBoolean isDefined () const
 Returns IlTrue if the error message is defined. More...
 
IliErrorMessageoperator= (const IliErrorMessage &msg)
 Assigns an error message. More...
 
void prettyPrint (IliString &dst) const
 Format error messages in an easily readable string. More...
 
void realize () const
 Forwards the error message to all the global error sinks that have been added with the addErrorSink() static member function.
 
void set (Severity severity, Origin origin, IlInt code, const char *message)
 Resets the error message properties. More...
 
void setApplicationError (const char *msg)
 Sets an application message error. More...
 
void unset ()
 Resets all properties so that the error message becomes undefined.
 

Static Public Member Functions

static void AddErrorSink (IliErrorSink *sink)
 Adds a global error sink. More...
 
static void ConnectToMessageDatabase (IlvDisplay *)
 This static member function calls the ReadMessageDatabase() member function. More...
 
static void ReadMessageDatabase (IlvDisplay *display)
 This static member function takes into account the translations for error messages that are currently in effect in the display message database. More...
 
static void RemoveErrorSink (IliErrorSink *sink)
 Removes a global error sink. More...
 

Detailed Description

Error Class.

Library: dataccess

The IliErrorMessage class is used to describe errors that occur during program execution. Errors may originate from different sources, such as the database server, the database client library, the Rogue Wave Views DB Link library, the Rogue Wave Views Data Access library, or the application itself. Each error message holds an error code whose meaning depends on the layer that triggered the error, and some descriptive text.

See also
IliErrorList, IliErrorReporter, IliErrorSink, IliErrorCodeTag.

Accessors\nAccessors provide a scriptable and uniform way to inspect and modify an object by using its base class methods <tt>IlvValueInterface::queryValue()</tt>, <tt>IlvValueInterface::queryValues()</tt>, <tt>IlvValueInterface::changeValue()</tt>, <tt>IlvValueInterface::changeValues()</tt>.\n\nThis class defines the following accessors:

Data accessors

Name Type Equivalent methods
code Int getCode(), set(...)
message String getMessage(), set(...)
origin Object getOrigin(), set(...)
prettyMessage String prettyPrint()
severity Object getSeverity(), set(...)

Here is an example of using an IliErrorMessage object in Rogue Wave Views Script:

function OnValidateRow(dataSource) {
if (dataSource.QTY.value < 0) {
var error = new IliErrorMessage();
error.message = "Quantity should be >= 0";
dataSource.addErrorMessage(error);
dataSource.dontValidateRow();
}
}

Member Enumeration Documentation

◆ Origin

The origin of the message.

Enumerator
UnknownOrigin 

The origin is unknown.

DbmsServer 

The origin comes from DBMS server.

DbmsClientAPI 

The origin comes from client API.

DbLink 

The origin comes from DbLink.

DataAccess 

The origin comes from Data Access.

Application 

The origin comes from the application.

◆ Severity

The severity of the message.

Enumerator
NotAnError 

It is not an error.

Warning 

It is a warning.

Error 

It is an error.

Constructor & Destructor Documentation

◆ IliErrorMessage()

IliErrorMessage::IliErrorMessage ( Severity  severity,
Origin  origin,
IlInt  code,
const char *  message 
)

This constructor initializes an error message.

Parameters
severityThe severity.
originThe origin.
codeThe code.
messageThe message.

Member Function Documentation

◆ AddErrorSink()

static void IliErrorMessage::AddErrorSink ( IliErrorSink sink)
static

Adds a global error sink.

When an error message is created, it will be forwarded to this error sink.

Parameters
sinkThe error sink.

◆ ConnectToMessageDatabase()

static void IliErrorMessage::ConnectToMessageDatabase ( IlvDisplay )
static

This static member function calls the ReadMessageDatabase() member function.

In addition, it installs a language change hook into the display that will call the ReadMessageDatabase() member function again each time a new language is made current.

◆ getCode()

IlInt IliErrorMessage::getCode ( ) const

Returns the error code of the error message.

Returns
The error code.

◆ getMessage()

const char* IliErrorMessage::getMessage ( ) const

Returns the descriptive message of the error.

Returns
The descriptive message.

◆ getOrigin()

Origin IliErrorMessage::getOrigin ( ) const

Returns the origin of the error message.

Returns
The origin.

◆ getSeverity()

Severity IliErrorMessage::getSeverity ( ) const

Returns the severity of the error message.

Returns
The severity.

◆ isAnError()

IlBoolean IliErrorMessage::isAnError ( ) const

Returns IlTrue if the severity of the error message is Error.

Returns
IlTrue if the severity of the error message is Error.

◆ isAWarning()

IlBoolean IliErrorMessage::isAWarning ( ) const

Returns IlTrue if the severity of the error message is Warning.

Returns
IlTrue if the severity of the error message is Warning.

◆ isDefined()

IlBoolean IliErrorMessage::isDefined ( ) const

Returns IlTrue if the error message is defined.

Returns
IlTrue if the error message is defined.

◆ operator=()

IliErrorMessage& IliErrorMessage::operator= ( const IliErrorMessage msg)

Assigns an error message.

Parameters
msgThe new message.

◆ prettyPrint()

void IliErrorMessage::prettyPrint ( IliString dst) const

Format error messages in an easily readable string.

Parameters
dstThe string where the output is written.

◆ ReadMessageDatabase()

static void IliErrorMessage::ReadMessageDatabase ( IlvDisplay display)
static

This static member function takes into account the translations for error messages that are currently in effect in the display message database.

This member function should be called after the dataccess/dataccess.dbm message database file has been read by the display.

◆ RemoveErrorSink()

static void IliErrorMessage::RemoveErrorSink ( IliErrorSink sink)
static

Removes a global error sink.

Parameters
sinkThe error sink.

◆ set()

void IliErrorMessage::set ( Severity  severity,
Origin  origin,
IlInt  code,
const char *  message 
)

Resets the error message properties.

Parameters
severityThe severity.
originThe origin.
codeThe code.
messageThe message.

◆ setApplicationError()

void IliErrorMessage::setApplicationError ( const char *  msg)

Sets an application message error.

Calling this member function is equivalent to calling

set(Error, Application, 0, message);
Parameters
msgThe error message.
IliErrorMessage::Error
@ Error
Definition: error.h:102
IliErrorMessage::IliErrorMessage
IliErrorMessage()
This constructor initializes an undefined error message.
IliErrorMessage::set
void set(Severity severity, Origin origin, IlInt code, const char *message)
Resets the error message properties.
IliErrorMessage::Application
@ Application
Definition: error.h:133