Error handle
This commit is contained in:
28
src/errorhandle/GUIErrorFactory.cpp
Normal file
28
src/errorhandle/GUIErrorFactory.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// Created by Krad on 2021/12/16.
|
||||
//
|
||||
|
||||
#include "GUIErrorFactory.h"
|
||||
#include "GUIErrorLE.h"
|
||||
|
||||
GUIErrorBase *GUIErrorFactory::getError(const QString &errorMsg) {
|
||||
|
||||
if (errorMsg.isEmpty()) return new GUIErrorBase;
|
||||
//新模式,分级
|
||||
if (errorMsg[1] == ' ') {
|
||||
char c = errorMsg[0].toLower().toLatin1();
|
||||
switch (c) {
|
||||
//WARN 级别
|
||||
case 'w': {
|
||||
return nullptr;
|
||||
}
|
||||
//ERROR 级别
|
||||
case 'e':
|
||||
default:
|
||||
auto error = new GUIErrorLE;
|
||||
error->parse(errorMsg);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
return new GUIErrorLE;
|
||||
}
|
||||
Reference in New Issue
Block a user