rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWUException Class Reference
[Exception Handling]

Exception class thrown by many methods in the Internationalization Module. More...

#include <rw/i18n/RWUException.h>

Inheritance diagram for RWUException:
RWxmsg

List of all members.

Public Member Functions

 RWUException (RWUStatusCode code)
 RWUException (const char *message, RWUStatusCode code=RWUNoError)
RWUStatusCode getStatus () const

Detailed Description

RWUException is thrown by many methods in the Internationalization Module. This class is a subclass of RWxmsg in the Essential Tools Module.

An RWUException instance contains a string message and an RWUStatusCode.

As with RWxmsg, the string message contains a textual description of the error, typically in English. The inherited why() method returns the message string contained in self. The RWUStatusCode of an RWUException identifies the type of the error. Member function getStatus() returns the RWUStatusCode.

Examples

 #include <rw/i18n/RWUException.h>
 #include <rw/i18n/RWUCollationKey.h>
 #include <iostream>
 
 using std::cout;
 using std::endl;
 
 int
 main()
 {
   // Attempt to use an invalid RWUCollationKey.
   try {
     RWUCollationKey invalidKey;
     cout << invalidKey.getString() << endl;
 
   // Catch the resulting exception.
   } catch (const RWUException& e) {
     cout << "Unable to obtain string from key:  " <<
      e.why() << endl;
   }
 
   return 0;
 } // main

Program output:

 Unable to obtain string from key:  invalid RWUCollationKey

Constructor & Destructor Documentation

RWUException::RWUException ( RWUStatusCode  code  )  [inline]

Constructs an RWUException from a given RWUStatusCode indicating the specific type of error encountered. The string message of the exception object is set to the name of the status code.

RWUException::RWUException ( const char *  message,
RWUStatusCode  code = RWUNoError 
) [inline]

Constructs an RWUException from an RWUStatusCode and a string message. The RWUStatusCode indicates the specific type of error encountered, and the string message describes the error.


Member Function Documentation

RWUStatusCode RWUException::getStatus (  )  const [inline]

Returns the RWUStatusCode contained in self.

 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.