2013-02-02 17:32:54 -05:00
|
|
|
#include "ErrorMessage.h"
|
|
|
|
#include "JsonSerializer.h"
|
|
|
|
|
|
|
|
ErrorMessage::ErrorMessage(QString message, QObject *parent) : QObject(parent) {
|
|
|
|
m_message = message;
|
|
|
|
}
|
|
|
|
|
|
|
|
ErrorMessage::ErrorMessage(QString type, QString message, QObject *parent) : QObject(parent) {
|
|
|
|
m_type = type;
|
|
|
|
m_message = message;
|
|
|
|
}
|
|
|
|
|
|
|
|
QByteArray ErrorMessage::toString() {
|
|
|
|
JsonSerializer serializer;
|
|
|
|
|
|
|
|
QVariantMap map;
|
|
|
|
|
|
|
|
if (m_type.isNull())
|
2013-05-21 07:58:46 -04:00
|
|
|
map["class"] = "InvalidResponseError";
|
2013-02-02 17:32:54 -05:00
|
|
|
else
|
2013-05-21 07:58:46 -04:00
|
|
|
map["class"] = m_type;
|
2013-02-02 17:32:54 -05:00
|
|
|
|
|
|
|
map["message"] = m_message;
|
|
|
|
|
|
|
|
return serializer.serialize(map);
|
|
|
|
}
|