libgenua
Basic Geometry, Numerical Algorithms and Interfaces
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Groups Pages
Public Member Functions | Private Attributes | List of all members
Error Class Reference

Detailed Description

Exception base class.

Base of all exceptions thrown in this library. It can be thrown with a string and (optionally) and int as arguments and sets a message string accordingly. Any main program should catch this exception type as in

  try
   {
     ... use smesh library ...
   }
  catch (Error & xcp)
   {
     cout << xcp.getMsg();
     exit(-1);
   }

A GUI application can perhaps pop up a message box instead of the terminal notification (which would be invisible to the user). Since all exceptions are derived from Error, the above catch{} block handles all of them.

#include <xcept.h>

Inherits std::runtime_error.

Public Member Functions

 Error ()
 empty constructor: do nothing
 
 Error (const std::string &s)
 print error message and quit
 
 Error (const std::string &s, int i)
 error message plus integer
 
std::string swhat () const
 error message as std::string
 
int code () const
 access error code (translations...)
 
const std::string & backtrace () const
 access stack backtrace (Linux only)
 

Private Attributes

int m_ecode
 error code
 
std::string m_btrace
 stack backtrace, on Linux and in debugging mode only
 

The documentation for this class was generated from the following files: