00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "GeneralException.h"
00021
00022 using namespace Util;
00023
00024 GeneralException::GeneralException(const std::string& error, const std::string file, size_t lineNumber) :
00025 errorMsg(error),
00026 fileName(file),
00027 lineNum(lineNumber)
00028 { }
00029
00030 std::string GeneralException::getError() const {
00031 if (errorMsg == "") {
00032 return "Unknown GeneralException";
00033 }
00034
00035 if (fileName == "") return errorMsg;
00036
00037 return "GeneralException: [ " + errorMsg + " ] exception thrown in file <" + fileName +
00038 "> at line " + toString(lineNum);
00039 }
00040
00041 std::ostream& operator << (std::ostream& stream, const GeneralException& e) {
00042 stream << e.getError();
00043 return stream;
00044 }
00045