ErrorHandler Class Reference

#include <ErrorHandler.hpp>

List of all members.

Public Types

enum  Type { asked, compilation, normal, unexpected }

Public Member Functions

virtual void writeErrorMessage ()
 ErrorHandler (const ErrorHandler &e)
 ErrorHandler (const std::string &filename, const size_t &lineNumber, const std::string &errorMessage, const Type &type)
virtual ~ErrorHandler ()

Private Attributes

const std::string __filename
const size_t __lineNumber
const std::string __errorMessage
const Type __type


Detailed Description

Definition at line 34 of file ErrorHandler.hpp.


Member Enumeration Documentation

Enumerator:
asked  execution request by the user
compilation  syntax error in a language
normal  normal error due to a bad use of ff3d
unexpected  Unexpected execution error

Definition at line 37 of file ErrorHandler.hpp.

00037             {
00038     asked,     
00039     compilation, 
00040     normal,    
00041     unexpected 
00042   };


Constructor & Destructor Documentation

ErrorHandler::ErrorHandler ( const ErrorHandler e  )  [inline]

The copy constructor

Parameters:
e an handled error

Definition at line 62 of file ErrorHandler.hpp.

00063     : __filename(e.__filename),
00064       __lineNumber(e.__lineNumber),
00065       __errorMessage(e.__errorMessage),
00066       __type(e.__type)
00067   {
00068     ;
00069   }

ErrorHandler::ErrorHandler ( const std::string &  filename,
const size_t &  lineNumber,
const std::string &  errorMessage,
const Type type 
)

Constructor

Parameters:
filename the source file name
lineNumber the source line
errorMessage the reported message
type the type of the error

Definition at line 58 of file ErrorHandler.cpp.

00062   : __filename(baseName(filename)),
00063     __lineNumber(lineNumber),
00064     __errorMessage(errorMessage),
00065     __type(type)
00066 {
00067   ;
00068 }

virtual ErrorHandler::~ErrorHandler (  )  [inline, virtual]

The destructor

Definition at line 88 of file ErrorHandler.hpp.

00089   {
00090     ;
00091   }


Member Function Documentation

void ErrorHandler::writeErrorMessage (  )  [virtual]

Prints the error message

Definition at line 25 of file ErrorHandler.cpp.

References __errorMessage, __filename, __lineNumber, __type, asked, compilation, fferr(), normal, and unexpected.

Referenced by LagrangianFiniteElement< 1, P0TetrahedronFiniteElement, QuadratureFormulaP0Tetrahedron >::LagrangianFiniteElement(), and FFThread::run().

00026 {
00027   switch(__type) {
00028   case asked: {
00029     fferr(3) << "\nremark: exit command explicitly called\n";
00030   }
00031   case normal: {
00032     fferr(3) << '\n' << __filename << ':' << __lineNumber
00033              << ":remark: emitted the following message\n";
00034     fferr(0) << "error: " << __errorMessage << '\n';
00035     break;
00036   }
00037   case compilation: {
00038     fferr(0) << "\nline " << __lineNumber << ':' << __errorMessage << '\n';
00039     break;
00040   }
00041   case unexpected: {
00042     fferr(0) << '\n' << __filename << ':' << __lineNumber << ":\n" << __errorMessage << '\n';
00043     fferr(0) << "\nUNEXPECTED ERROR: this should not occure, please report it\n";
00044     fferr(0) << "\nBUG REPORT: Please send bug reports to:\n"
00045              << "  ff3d-dev@nongnu.org or freefem@ann.jussieu.fr\n"
00046              << "or better, use the Bug Tracking System:\n"
00047              << "  http://savannah.nongnu.org/bugs/?group=ff3d\n";
00048     break;
00049   }
00050   default: {
00051     fferr(0) << __filename << ':' << __lineNumber << ": " << __errorMessage << '\n';
00052     fferr(0) << __FILE__ << ':' << __LINE__ << ":remark:  error type not implemented!\n";
00053   }
00054   }
00055 }

Here is the call graph for this function:


Member Data Documentation

const std::string ErrorHandler::__filename [private]

The source file name where the error occured

Definition at line 45 of file ErrorHandler.hpp.

Referenced by writeErrorMessage().

const size_t ErrorHandler::__lineNumber [private]

The line number where exception was raised

Definition at line 46 of file ErrorHandler.hpp.

Referenced by writeErrorMessage().

const std::string ErrorHandler::__errorMessage [private]

The reporting message

Definition at line 47 of file ErrorHandler.hpp.

Referenced by writeErrorMessage().

const Type ErrorHandler::__type [private]

the type of the error

Definition at line 49 of file ErrorHandler.hpp.

Referenced by writeErrorMessage().


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

Generated on Wed Nov 19 00:06:06 2008 for FreeFEM3D (aka ff3d) by  doxygen 1.5.6