added error on parse + obj
This commit is contained in:
parent
7a2f9bf7ad
commit
43d9f243d8
|
@ -221,6 +221,7 @@ Add unit tests for any new or changed functionality. Lint and test your code.
|
|||
* refined css so question/loader/error are equal.
|
||||
* Added response header check support.
|
||||
* Added json accept header on assets resources list.
|
||||
* Added cb errors on assets resources json parse + result obj.
|
||||
|
||||
### 0.1.1
|
||||
* Moved websql delete timeout to cleanServerlUrl for faster boot.
|
||||
|
|
|
@ -761,7 +761,22 @@
|
|||
}
|
||||
return;
|
||||
}
|
||||
var resources = JSON.parse(httpRequest.responseText).data.resources;
|
||||
var resources = null;
|
||||
try {
|
||||
var responseObject = JSON.parse(httpRequest.responseText);
|
||||
if (responseObject.data === undefined) {
|
||||
return cb('No data in json');
|
||||
}
|
||||
if (responseObject.data.resources === undefined) {
|
||||
return cb('No resources in json');
|
||||
}
|
||||
if (responseObject.data.resources.length === 0) {
|
||||
return cb('Empty resources in json');
|
||||
}
|
||||
resources = responseObject.data.resources;
|
||||
} catch (parseError) {
|
||||
return cb(parseError);
|
||||
}
|
||||
utilDebug('startLoader resources '+resources.length);
|
||||
|
||||
var progressBar = createLoaderBar(resources);
|
||||
|
|
Loading…
Reference in a new issue