Commit 7cfd26b4eb3280185796203a7f96d675d7c79b33

Authored by Josh Klontz
1 parent 616ec701

better json parsing diagnostics

Showing 1 changed file with 5 additions and 2 deletions
openbr/plugins/gallery.cpp
@@ -350,9 +350,12 @@ class jsonGallery : public BinaryGallery @@ -350,9 +350,12 @@ class jsonGallery : public BinaryGallery
350 Template readTemplate() 350 Template readTemplate()
351 { 351 {
352 QJsonParseError error; 352 QJsonParseError error;
353 - File file = QJsonDocument::fromJson(gallery.readLine(), &error).object().toVariantMap();  
354 - if (error.error != QJsonParseError::NoError) 353 + const QByteArray line = gallery.readLine();
  354 + File file = QJsonDocument::fromJson(line, &error).object().toVariantMap();
  355 + if (error.error != QJsonParseError::NoError) {
  356 + qWarning("Couldn't parse: %s\n", line.data());
355 qFatal("%s\n", qPrintable(error.errorString())); 357 qFatal("%s\n", qPrintable(error.errorString()));
  358 + }
356 return file; 359 return file;
357 } 360 }
358 361