You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
915 B
54 lines
915 B
4 years ago
|
#ifndef HARDWAREEXCEPTION_H
|
||
|
#define HARDWAREEXCEPTION_H
|
||
|
|
||
|
#include <exception>
|
||
|
|
||
|
#include "logger/ESeverityLevel.h"
|
||
|
#include "model/hardware/exception/HwExceptionDef.h"
|
||
|
|
||
|
class HardwareException : public std::exception
|
||
|
{
|
||
|
private:
|
||
|
quint32 _errId;
|
||
|
QString _innerMessage;
|
||
|
|
||
|
public:
|
||
|
explicit HardwareException(quint32 errId)
|
||
|
{
|
||
|
_errId = errId;
|
||
|
}
|
||
|
|
||
|
explicit HardwareException(quint32 errId, QString innerMessage)
|
||
|
{
|
||
|
_errId = errId;
|
||
|
_innerMessage = innerMessage;
|
||
|
}
|
||
|
|
||
|
const char* what() const noexcept override
|
||
|
{
|
||
|
return HwErrors::getErrorMessage(_errId).toStdString().c_str();
|
||
|
}
|
||
|
|
||
|
ESeverityLevel::eSeverityLevel getSeverityLevel() const
|
||
|
{
|
||
|
return HwErrors::getSeverityLevel(_errId);
|
||
|
}
|
||
|
|
||
|
quint32 errId() const
|
||
|
{
|
||
|
return _errId;
|
||
|
}
|
||
|
|
||
|
QString getInnerMessage() const
|
||
|
{
|
||
|
return _innerMessage;
|
||
|
}
|
||
|
|
||
|
QString getMessage() const
|
||
|
{
|
||
|
return HwErrors::getErrorMessage(_errId);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
#endif //HARDWAREEXCEPTION_H
|