examples/quick/shared/FlickrRssModel.qml: Do proper error handling

Change-Id: Ieaed0706965bbb259934fb83151856f3d5805331
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Maximilian Goldstein 2019-11-29 10:10:24 +01:00
parent c2f6a4cf63
commit 265a6dc6e2
1 changed files with 6 additions and 0 deletions

View File

@ -63,6 +63,12 @@ ListModel {
var xhr = new XMLHttpRequest;
xhr.onreadystatechange = function() {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status !== 200) {
console.log("Failed to get images from flickr. status code: " + xhr.status);
return;
}
var jsonText = xhr.responseText;
var objArray = JSON.parse(jsonText.replace(/\'/g,"'"))
if (objArray.errors !== undefined)