C++ Portable Types Library (PTypes) Version 1.8


Top: Exceptions and critical errors

Some of the components in PTypes may produce unrecoverable error conditions, such like a string list index is out of bounds, a stream object is constructed with inconsistent parameters, an operation on a stream is requested which requires buffering, etc. These errors are mainly caused by wrong usage of certain objects or functions of the library.

Whenever an unrecoverable error condition is raised, PTypes calls fatal() function with a message describing the error condition and terminates the program. On most platforms this message is being sent to stderr, and on Windows the message is shown in a simple message box.

The function fatal() is declared in <pport.h>.

Some library components also raise recoverable error conditions (exceptions). PTypes only generates exception of type exceptobj* defined in <ptypes.h>, or, in some cases, a derivative class, e.g. estream*. An exception object at least contains an error message which can be retrieved through get_message() method. Exception objects are allocated dynamically, and therefore they should be freed by the catch block if it does not pass the exception farther. See also Streams Error handling and Examples.


PTypes home