2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
|
|
|
|
#include "tstreamexception.h"
|
|
|
|
#include "tfilepath.h"
|
|
|
|
#include "tconvert.h"
|
|
|
|
#include "tstream.h"
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
std::wstring getLocation(TIStream &is) {
|
|
|
|
return L"File: " + is.getFilePath().getWideString() + L":" +
|
|
|
|
std::to_wstring(is.getLine());
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
std::wstring message(TIStream &is, std::wstring msg) {
|
|
|
|
return getLocation(is) + L"\n" + msg;
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
std::wstring message(TIStream &is, std::string msg) {
|
|
|
|
return message(is, ::to_wstring(msg));
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
} // namespace
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
TIStreamException::TIStreamException(TIStream &is)
|
2016-06-15 18:43:10 +12:00
|
|
|
: TException(message(is, L"unknown exception")) {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
TIStreamException::TIStreamException(TIStream &is, const TException &e)
|
2016-06-15 18:43:10 +12:00
|
|
|
: TException(message(is, e.getMessage())) {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-04-19 19:32:17 +12:00
|
|
|
TIStreamException::TIStreamException(TIStream &is, std::wstring msg)
|
2016-06-15 18:43:10 +12:00
|
|
|
: TException(message(is, msg)) {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-04-19 19:32:17 +12:00
|
|
|
TIStreamException::TIStreamException(TIStream &is, std::string msg)
|
2016-06-15 18:43:10 +12:00
|
|
|
: TException(message(is, msg)) {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
TIStreamException::~TIStreamException() {}
|