SysCallExcn Class Reference

Exception class for failed system calls. More...

#include <SysCallExcn.h>

Inheritance diagram for SysCallExcn:

FennelExcn List of all members.

Public Member Functions

 SysCallExcn (std::string msgInit)
 Constructs a new SysCallExcn.
 SysCallExcn (std::string msgInit, int errCodeInit)
 Constructs a new SysCallExcn.
int getErrorCode ()
 Returns the error code that caused this SysCallExcn.
virtual const char * what () const throw ()
virtual void throwSelf ()
std::string const & getMessage ()

Static Public Member Functions

static int getCurrentErrorCode ()
 Returns the current OS error code.

Protected Attributes

std::string msg

Private Member Functions

void init ()

Private Attributes

int errCode

Detailed Description

Exception class for failed system calls.

Definition at line 34 of file SysCallExcn.h.


Constructor & Destructor Documentation

SysCallExcn::SysCallExcn ( std::string  msgInit  )  [explicit]

Constructs a new SysCallExcn.

This should be called immediately after the failed system call in order to get the correct information from the OS.

Parameters:
msgInit a description of the failure from the program's point of view; SysCallExcn will append additional information from the OS

Definition at line 36 of file SysCallExcn.cpp.

References init().

00037     : FennelExcn(msgInit), errCode(getCurrentErrorCode())
00038 {
00039     init();
00040 }

SysCallExcn::SysCallExcn ( std::string  msgInit,
int  errCodeInit 
) [explicit]

Constructs a new SysCallExcn.

This may be deferred until some time after the failed system call, as long as the OS error code has been saved.

Parameters:
msgInit a description of the failure from the program's point of view; SysCallExcn will append additional information from the OS
errCodeInit OS error code used to generate additional information

Definition at line 42 of file SysCallExcn.cpp.

References init().

00043     : FennelExcn(msgInit), errCode(errCodeInit)
00044 {
00045     init();
00046 }


Member Function Documentation

void SysCallExcn::init (  )  [private]

Definition at line 48 of file SysCallExcn.cpp.

References errCode, and FennelExcn::msg.

Referenced by SysCallExcn().

00049 {
00050     std::ostringstream oss;
00051     oss << msg;
00052     oss << ": ";
00053 
00054 #ifdef __MSVC__
00055     oss << "GetLastError() = ";
00056     oss << errCode;
00057 #else
00058     char *pMsg = strerror(errCode);
00059     if (pMsg) {
00060         oss << pMsg;
00061     } else {
00062         oss << "errno = ";
00063         oss << errCode;
00064     }
00065 #endif
00066     msg = oss.str();
00067     msg = FennelResource::instance().sysCallFailed(msg);
00068 }

int SysCallExcn::getErrorCode (  ) 

Returns the error code that caused this SysCallExcn.

Definition at line 71 of file SysCallExcn.cpp.

References errCode.

00072 {
00073     return errCode;
00074 }

int SysCallExcn::getCurrentErrorCode (  )  [static]

Returns the current OS error code.

This function may be used to retrieve an error code for use with the 2 argument constructor. The function should be called immediately after the failed system call in order to get the correct information from the OS.

Returns:
the current OS error code

Definition at line 76 of file SysCallExcn.cpp.

Referenced by VMAllocator::allocate(), VMAllocator::deallocate(), and VMAllocator::setProtection().

00077 {
00078 #ifdef __MING32__
00079     return GetLastError();
00080 #else
00081     return errno;
00082 #endif
00083 }

const char * FennelExcn::what (  )  const throw () [virtual, inherited]

Definition at line 38 of file FennelExcn.cpp.

References FennelExcn::msg.

Referenced by CalcExtMathTest::testCalcExtMathLogarithmsFails(), CalcExtMathTest::testCalcExtMathPow(), and CalcExtMathTest::testCalcExtMathPowFails().

00039 {
00040     return msg.c_str();
00041 }

void FennelExcn::throwSelf (  )  [virtual, inherited]

Reimplemented in JavaExcn.

Definition at line 43 of file FennelExcn.cpp.

00044 {
00045     throw *this;
00046 }

std::string const& FennelExcn::getMessage (  )  [inline, inherited]

Definition at line 52 of file FennelExcn.h.

Referenced by CalcAssembler::assemble(), CalcAssemblerTestCase::assemble(), CalcAssembler::bindRegisterValue(), CalcAssembler::createInstruction(), CalcExecStream::execute(), JniEnvRef::handleExcn(), CalcExtWinAggFuncTest::initWindowedAggDataBlock(), FlatFileExecStreamImpl::open(), CalcExecStream::prepare(), BackupRestoreTest::testBackupCleanup(), CalcInstFactoryTest::testBool(), CalcInstFactoryTest::testBoolNative(), CalcInstFactoryTest::testBoolPointer(), CalcMiscTest::testCalcContinueOnException(), CalcExtCastTest::testCalcExtCastApproxToString(), CalcExtCastTest::testCalcExtCastBigExactToString(), CalcExtCastTest::testCalcExtCastBooleanToChar(), CalcExtCastTest::testCalcExtCastBooleanToVarChar(), CalcExtCastTest::testCalcExtCastCharToBoolean(), CalcExtCastTest::testCalcExtCastCharToDecimal(), CalcExtCastTest::testCalcExtCastCharToExact(), CalcExtCastTest::testCalcExtCastDecimalToChar(), CalcExtCastTest::testCalcExtCastDecimalToStringTruncates(), CalcExtCastTest::testCalcExtCastDecimalToVarChar(), CalcExtCastTest::testCalcExtCastExactToChar(), CalcExtCastTest::testCalcExtCastExactToStringTruncates(), CalcExtCastTest::testCalcExtCastExactToVarChar(), CalcExtCastTest::testCalcExtCastStringToApprox(), CalcExtCastTest::testCalcExtCastStringToChar(), CalcExtCastTest::testCalcExtCastStringToDecimalFails(), CalcExtCastTest::testCalcExtCastStringToDecimalMinMax(), CalcExtCastTest::testCalcExtCastStringToDecimalRange(), CalcExtCastTest::testCalcExtCastStringToExactFails(), CalcExtCastTest::testCalcExtCastStringToVarChar(), CalcExtCastTest::testCalcExtCastVarCharToBoolean(), CalcExtCastTest::testCalcExtCastVarCharToDecimal(), CalcExtCastTest::testCalcExtCastVarCharToExact(), CalcExtContextTest::testCalcExtContext(), CalcExtDateTimeTest::testCalcExtConvertDateToString(), CalcExtDynamicVariableTest::testCalcExtDynamicVariable(), CalcExtDateTimeTest::testCalcExtLocalTime(), CalcExtDateTimeTest::testCalcExtLocalTimestamp(), CalcExtMathTest::testCalcExtMathAbs(), CalcExtMathTest::testCalcExtMathLogarithms(), CalcExtMathTest::testCalcExtMathLogarithmsFails(), CalcExtMathTest::testCalcExtMathPow(), CalcExtMathTest::testCalcExtMathPowFails(), CalcExtRegExpTest::testCalcExtRegExpLikeAChar(), CalcExtRegExpTest::testCalcExtRegExpLikeAVarChar(), CalcExtRegExpTest::testCalcExtRegExpSimilarAChar(), CalcExtRegExpTest::testCalcExtRegExpSimilarAVarChar(), CalcExtStringTest::testCalcExtStringCatA2(), CalcExtStringTest::testCalcExtStringCatA3(), CalcExtStringTest::testCalcExtStringCmpA(), CalcExtStringTest::testCalcExtStringCmpOct(), CalcExtStringTest::testCalcExtStringLenBitA(), CalcExtStringTest::testCalcExtStringLenCharA(), CalcExtStringTest::testCalcExtStringLenOctA(), CalcExtStringTest::testCalcExtStringOverlayA4(), CalcExtStringTest::testCalcExtStringOverlayA5(), CalcExtStringTest::testCalcExtStringPosA(), CalcExtStringTest::testCalcExtStringSubStringA3(), CalcExtStringTest::testCalcExtStringSubStringA4(), CalcExtStringTest::testCalcExtStringToANull(), CalcExtStringTest::testCalcExtStringToLower(), CalcExtStringTest::testCalcExtStringToUpper(), CalcExtStringTest::testCalcExtStringTrim(), CalcMiscTest::testCalcRaise(), CalcMiscTest::testCalcRefInst(), CalcMiscTest::testCalcReturn(), CalcMiscTest::testCalcStatusReg(), CalcMiscTest::testCalcStatusRegZero(), CalcCastTest::testExe(), ExecStreamGovernorTest::testGovernor(), CalcInstFactoryTest::testIntegralNative(), CalcInstFactoryTest::testIntegralPointer(), CalcInstFactoryTest::testJump(), CalcInstFactoryTest::testNativeNative(), CalcInstFactoryTest::testPointerIntegral(), CalcInstFactoryTest::testPointerPointer(), CalcInstFactoryTest::testReturn(), CalcCastTest::testRoundInstruction(), WinAggAddTest(), WinAggAddTestStr(), WinAggDropTest(), and WinAggDropTestStr().

00053     {
00054         return msg;
00055     }


Member Data Documentation

int SysCallExcn::errCode [private]

Definition at line 37 of file SysCallExcn.h.

Referenced by getErrorCode(), and init().

std::string FennelExcn::msg [protected, inherited]

Definition at line 35 of file FennelExcn.h.

Referenced by BTreeDuplicateKeyExcn::BTreeDuplicateKeyExcn(), CalcExcn::CalcExcn(), JavaExcn::getStackTrace(), init(), InvalidParamExcn::InvalidParamExcn(), InvalidValueException< T >::InvalidValueException(), JavaExcn::JavaExcn(), TupleOverflowExcn::TupleOverflowExcn(), and FennelExcn::what().


The documentation for this class was generated from the following files:
Generated on Mon Jun 22 04:00:47 2009 for Fennel by  doxygen 1.5.1