Files
newspark110/device/exception/myexception.cpp
Chenwenxuan edac2715f0 init
2024-03-06 14:54:30 +08:00

71 lines
1.2 KiB
C++

#include "myexception.h"
MyException::MyException(ExceptLevel value)
{
exceptInfo = QString("");
level = value;
exceptCode = NOTHING;
}
MyException::MyException(const QString& text,ExceptLevel value)
{
exceptInfo = text;
level = value;
exceptCode = NOTHING;
}
MyException::MyException(int exceptCodeValue,ExceptLevel value)
{
exceptCode = exceptCodeValue;
level = value;
exceptInfo = QString("");
}
MyException::MyException(QString text,int exceptCodeValue,ExceptLevel value)
{
exceptInfo = text;
exceptCode = exceptCodeValue;
level = value;
}
void MyException::setExceptLevel(ExceptLevel levelValue)
{
level = levelValue;
}
QString MyException::getExceptInfo()
{
return exceptInfo;
}
QString MyException::getExceptInfoWithExceptCode()
{
return exceptInfo+getExceptCodeText();
}
int MyException::getExceptCode()
{
return exceptCode;
}
void MyException::setExceptCode(int value)
{
exceptCode = value;
}
ExceptLevel MyException::getExceptLevel()
{
return level;
}
void MyException::setExceptInfo(QString text)
{
exceptInfo = text;
}
QString MyException::getExceptCodeText()
{
return QString(" 异常代码为:%1").arg(exceptCode);
}