Rogue Wave Views
Data Access Package API Reference Guide
Product Documentation:

Rogue Wave 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

Public Member Functions

 IliErrorMessage ()
 This constructor initializes an undefined error message.
 
 IliErrorMessage (Severity severity, Origin origin, IlInt code, const char *message)
 This constructor initializes an error message. More...
 
 IliErrorMessage (const IliErrorMessage &)
 This constructor copies an error message.
 
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

Accessors provide a scriptable and uniform way to inspect and modify an object by using its base class methods IlvValueInterface::queryValue(), IlvValueInterface::queryValues(), IlvValueInterface::changeValue(), IlvValueInterface::changeValues(). This 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

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.

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 ( 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

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

IlInt IliErrorMessage::getCode ( ) const

Returns the error code of the error message.

Returns
The error code.
const char* IliErrorMessage::getMessage ( ) const

Returns the descriptive message of the error.

Returns
The descriptive message.
Origin IliErrorMessage::getOrigin ( ) const

Returns the origin of the error message.

Returns
The origin.
Severity IliErrorMessage::getSeverity ( ) const

Returns the severity of the error message.

Returns
The severity.
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.
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.
IlBoolean IliErrorMessage::isDefined ( ) const

Returns IlTrue if the error message is defined.

Returns
IlTrue if the error message is defined.
IliErrorMessage& IliErrorMessage::operator= ( const IliErrorMessage msg)

Assigns an error message.

Parameters
msgThe new message.
void IliErrorMessage::prettyPrint ( IliString dst) const

Format error messages in an easily readable string.

Parameters
dstThe string where the output is written.
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.

static void IliErrorMessage::RemoveErrorSink ( IliErrorSink sink)
static

Removes a global error sink.

Parameters
sinkThe error sink.
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.
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.

© Copyright 2016, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.