File tree Expand file tree Collapse file tree 2 files changed +18
-5
lines changed
Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -98,8 +98,11 @@ class QX_CORE_EXPORT File
9898
9999class QX_CORE_EXPORT Data
100100{
101+ private:
102+ QString mDataError ;
103+
101104public:
102- Data ();
105+ Data (const QString& dataError = {} );
103106
104107 QString string () const ;
105108};
@@ -812,7 +815,7 @@ JsonError parseJson(T& parsed, const QByteArray& data)
812815 QJsonDocument jd = QJsonDocument::fromJson (data, &jpe);
813816
814817 if (jpe.error != jpe.NoError )
815- return JsonError (QxJsonPrivate::ERR_READ_DATA, JsonError::InvalidData).withContext (QxJson::Data ());
818+ return JsonError (QxJsonPrivate::ERR_READ_DATA, JsonError::InvalidData).withContext (QxJson::Data (jpe. errorString () ));
816819
817820 // True parse
818821 return parseJson (parsed, jd).withContext (QxJson::Data ());
Original file line number Diff line number Diff line change @@ -509,14 +509,24 @@ QString File::string() const
509509 */
510510
511511/* !
512- * Constructs a data element node.
512+ * Constructs a data element node with data specific error information @a dataError,
513+ * if any.
513514 */
514- Data::Data () {}
515+ Data::Data (const QString& dataError) :
516+ mDataError (dataError)
517+ {}
515518
516519/* !
517520 * Returns the string representation of the node.
518521 */
519- QString Data::string () const { return u" Data" _s; }
522+ QString Data::string () const
523+ {
524+ QString str = u" Data:" _s;
525+ if (!mDataError .isEmpty ())
526+ str += (u" \n [%1]" _s).arg (mDataError );
527+
528+ return str;
529+ }
520530
521531/* !
522532 * @class Document
You can’t perform that action at this time.
0 commit comments