mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 10:15:38 +08:00
refs #751, detect invalid JSON message
(which normally means a PHP error message in HTML) * utility function to remove HTML parts * adjustments
This commit is contained in:
committed by
Roland Winklmeier
parent
2cc88d9c6a
commit
03c642d88a
@@ -11,6 +11,7 @@
|
||||
#include "blackmisc/logcategory.h"
|
||||
#include "blackmisc/logcategorylist.h"
|
||||
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||
#include "blackmisc/network/networkutils.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
#include "blackmisc/statusmessagelist.h"
|
||||
#include "blackmisc/stringutils.h"
|
||||
@@ -24,6 +25,7 @@
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackMisc::Network;
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
@@ -97,8 +99,7 @@ namespace BlackMisc
|
||||
// no object -> most likely some fucked up HTML string with the PHP error
|
||||
if (!jsonDoc.isObject())
|
||||
{
|
||||
QString phpError(jsonResponse);
|
||||
phpError.remove(QRegExp("<[^>]*>"));
|
||||
const QString phpError(CNetworkUtils::removeHtmlPartsFromPhpErrorMessage(jsonResponse));
|
||||
messages.push_back(CStatusMessage(cats, CStatusMessage::SeverityError, phpError));
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user