You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
|
/**
|
|
|
|
|
|
* @file WException.h
|
|
|
|
|
|
* @brief <EFBFBD>쳣<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
* @author ɳĮ<EFBFBD><EFBFBD>ѻ
|
|
|
|
|
|
* @time 2010-07-23
|
|
|
|
|
|
*/
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdexcept>
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
|
|
|
|
#pragma warning(disable : 4290) // disable Exception Specification warning
|
|
|
|
|
|
|
|
|
|
|
|
namespace wuya
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1>ǰ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD>еĺ<D0B5>
|
|
|
|
|
|
#define LOCATION WLocation(__FILE__, __LINE__)
|
|
|
|
|
|
|
|
|
|
|
|
inline
|
|
|
|
|
|
std::string WLocation(std::string strFile,int iLineNo)
|
|
|
|
|
|
{
|
|
|
|
|
|
const int bufSize = 64;
|
|
|
|
|
|
char buf[bufSize];
|
|
|
|
|
|
sprintf_s(buf,bufSize,"Line no. %d", iLineNo);
|
|
|
|
|
|
|
|
|
|
|
|
return strFile + buf;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** @brief <09><><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3><EFBFBD><EFBFBD> */
|
|
|
|
|
|
class WException : public std::runtime_error
|
|
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
WException() throw() : runtime_error("error") {}
|
|
|
|
|
|
WException(std::string msg) throw() : runtime_error(msg) {}
|
|
|
|
|
|
WException(std::string msg, std::string location) throw() : std::runtime_error(msg + location) {}
|
|
|
|
|
|
|
|
|
|
|
|
void WriteLog(std::ostream& os) throw() { os << what() << std::endl; }
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|