Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Introduction to HydraExpress
Rogue Wave web site:  Home Page  |  Main Documentation Page

8.2 Exceptions

Exceptions are signaled by throwing a rwsf::Exception or one of its derived classes.

8.2.1 Exception Class Hierarchy

Exceptions fall in the following general categories:

It is generally preferable to catch the most specific exception possible, so that it will not be confused with other exceptions that might indicate real errors.

8.2.2 Localized Exception Strings

As described in Chapter 7, all HydraExpress system messages are stored in external UTF-8 message catalogs. A central rwsf::MessageCatalogManager loads the strings at runtime, and provides the ability to switch languages dynamically. Class rwsf::LocalizedMessage is the primary class used for accessing a localized string.

You can construct an rwsf::Exception instance from an rwsf::LocalizedMessage. For example:

Which produces this output (on Windows):

Note that the message identifier -- UNEXPECTED_ERROR, in this example -- is automatically prepended to the exception string.


RWSF_EINFO is a macro that expands to a temporary instance of rwsf::ExceptionInfo, with the proper preprocessor directives to populate the filename, function name, and line number fields in the exception.

See Chapter 7 for more information on how to set the default local, build message catalogs, access localized messages, and change the locale dynamically.

8.2.3 Standard Library Exceptions

For services that use default data mappings and with the -stl option, message text is returned for exceptions derived from std::exception and rwsf::Exception, so you will want to be prepared to catch these exceptions.

8.2.4 SourcePro Exceptions

For services that use SourcePro, message text is returned not only for std::exception and rwsf::Exception but also for RWxmsg, so exception-safe code should be prepared to catch and handle these exception types.



Previous fileTop of DocumentContentsIndex pageNext file

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