tahoma2d/toonz/sources/common/tstream/tstreamexception.cpp

53 lines
947 B
C++
Raw Normal View History

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