diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-02-23 10:42:44 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2018-02-23 10:42:44 +0900 |
commit | 8fbbd6063a2d313c630d14842bbce4de8c1e7851 (patch) | |
tree | 0a854eca074ff2293374f791da7172560dcca8da | |
parent | d54bdd710163afe9e09b2c4c65bbf21454ed2ceb (diff) | |
download | libquotient-8fbbd6063a2d313c630d14842bbce4de8c1e7851.tar.gz libquotient-8fbbd6063a2d313c630d14842bbce4de8c1e7851.zip |
BaseJob: In case of 4xx errors, fill the status with the message from the response
-rw-r--r-- | jobs/basejob.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/jobs/basejob.cpp b/jobs/basejob.cpp index 5f5aa410..c3b110f0 100644 --- a/jobs/basejob.cpp +++ b/jobs/basejob.cpp @@ -267,6 +267,12 @@ void BaseJob::gotReply() setStatus(checkReply(d->reply.data())); if (status().good()) setStatus(parseReply(d->reply.data())); + else + { + auto json = QJsonDocument::fromJson(d->reply->readAll()).object(); + if (!json.isEmpty()) + setStatus(IncorrectRequestError, json.value("error").toString()); + } finishJob(); } |