Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 930a0147 authored by Volker Krause's avatar Volker Krause

Improve diagnostics when failing to parse JSON data

parent 05959a2e
......@@ -96,8 +96,11 @@ void StructuredDataExtractor::findLdJson(const QString &text)
}
i = text.indexOf(QLatin1String("</script>"), begin, Qt::CaseInsensitive);
const auto jsonData = text.mid(begin, i - begin);
auto jsonDoc = QJsonDocument::fromJson(jsonData.toUtf8());
QJsonParseError error;
auto jsonDoc = QJsonDocument::fromJson(jsonData.toUtf8(), &error);
if (jsonDoc.isNull()) {
qCDebug(SEMANTIC_LOG).noquote() << jsonData;
qCDebug(SEMANTIC_LOG) << error.errorString() << "at offset" << error.offset;
continue;
}
if (jsonDoc.isArray()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment