EMAN::E2Exception Class Reference

E2Exception class is the parent class of all EMAN2 E2Exceptions. More...

#include <exception.h>

Inheritance diagram for EMAN::E2Exception:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 E2Exception (const string &file="", int line=0, const string &desc_str="", const string &objname_str="")
 Contructor.
virtual ~E2Exception () throw ()
virtual const char * what () const throw ()
 The E2Exception information.
virtual const char * name () const
 The name of this E2Exception class.

Protected Attributes

string filename
int linenum
string desc
string objname

Detailed Description

E2Exception class is the parent class of all EMAN2 E2Exceptions.

Definition at line 75 of file exception.h.


Constructor & Destructor Documentation

EMAN::E2Exception::E2Exception ( const string &  file = "",
int  line = 0,
const string &  desc_str = "",
const string &  objname_str = "" 
) [inline, explicit]

Contructor.

Parameters:
file The name of the file where an E2Exception is thrown.
line The line number in the file where the E2Exception is thrown.
desc_str E2Exception description string.
objname_str E2Exception involved object name.

Definition at line 85 of file exception.h.

00087                         : filename(file), linenum(line), desc(desc_str), objname(objname_str)
00088                 {
00089                         // Log the message
00090                         stringstream ss;
00091                         string line_str;
00092                         ss << line;
00093                         ss >> line_str;
00094 // We shouldn't log all exceptions, since they are frequently used intentionally, with no implied error
00095 //                      string message = "File " + file + " line " + line_str + " description " + desc_str + " " + objname_str;
00096 //                      LOGERR( message.c_str() );
00097                 }

virtual EMAN::E2Exception::~E2Exception (  )  throw () [inline, virtual]

Definition at line 99 of file exception.h.

00099 {}


Member Function Documentation

virtual const char* EMAN::E2Exception::name (  )  const [inline, virtual]

The name of this E2Exception class.

Returns:
The name of this E2Exception class.

Reimplemented in EMAN::_NotExistingObjectException, EMAN::_ImageFormatException, EMAN::_ImageDimensionException, EMAN::_FileAccessException, EMAN::_ImageReadException, EMAN::_ImageWriteException, EMAN::_NullPointerException, EMAN::_TypeException, EMAN::_InvalidValueException, EMAN::_InvalidStringException, EMAN::_OutofRangeException, EMAN::_InvalidCallException, EMAN::_InvalidParameterException, EMAN::_EmptyContainerException, EMAN::_BadAllocException, and EMAN::_UnexpectedBehaviorException.

Definition at line 111 of file exception.h.

Referenced by what().

00111 { return "Exception"; }

const char * E2Exception::what (  )  const throw () [virtual]

The E2Exception information.

Returns:
The E2Exception information including E2Exception location (filename, line number,function name) and description.

Definition at line 40 of file exception.cpp.

References desc, filename, EMAN::Util::int2str(), linenum, name(), and objname.

Referenced by main().

00041 {
00042         string err1 = "";
00043         if (objname != "") {
00044                 err1 = "error with '" + objname + "': ";
00045         }
00046 
00047         string msg = string(name()) + " at " + filename + ":" + Util::int2str(linenum);
00048         msg += ": " + err1 + "'" + desc + "' caught\n";
00049         return msg.c_str();
00050 }


Member Data Documentation

string EMAN::E2Exception::desc [protected]

Definition at line 115 of file exception.h.

Referenced by EMAN::_FileAccessException::_FileAccessException(), EMAN::_OutofRangeException::_OutofRangeException(), and what().

string EMAN::E2Exception::filename [protected]

Definition at line 113 of file exception.h.

Referenced by what().

int EMAN::E2Exception::linenum [protected]

Definition at line 114 of file exception.h.

Referenced by what().

string EMAN::E2Exception::objname [protected]

Definition at line 116 of file exception.h.

Referenced by EMAN::_InvalidStringException::_InvalidStringException(), EMAN::_InvalidValueException::_InvalidValueException(), and what().


The documentation for this class was generated from the following files:
Generated on Tue Jun 11 12:43:06 2013 for EMAN2 by  doxygen 1.4.7