summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Krause <[email protected]>2018-02-02 14:51:04 +0100
committerVolker Krause <[email protected]>2018-02-02 14:51:04 +0100
commit930a014767829500be688d2a39f178f9c9babf91 (patch)
treebb91ab4314dd8d72aec0ade2c9c7de7f9590af84
parent05959a2e2f772ed37a5b3d51455c1a1f54f4f2ea (diff)
Improve diagnostics when failing to parse JSON data
-rw-r--r--plugins/messageviewer/bodypartformatter/semantic/structureddataextractor.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/plugins/messageviewer/bodypartformatter/semantic/structureddataextractor.cpp b/plugins/messageviewer/bodypartformatter/semantic/structureddataextractor.cpp
index 8f64ab8..4099881 100644
--- a/plugins/messageviewer/bodypartformatter/semantic/structureddataextractor.cpp
+++ b/plugins/messageviewer/bodypartformatter/semantic/structureddataextractor.cpp
@@ -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()) {