mirror of
https://github.com/ansible/awx.git
synced 2026-05-11 11:27:36 -02:30
Add error handling to retrieval service
This commit is contained in:
@@ -22,6 +22,18 @@ function JobStatusGraphData(Rest, getBasePath, processErrors, $rootScope, $q) {
|
|||||||
$rootScope.
|
$rootScope.
|
||||||
$broadcast('DataReceived:JobStatusGraph',
|
$broadcast('DataReceived:JobStatusGraph',
|
||||||
result);
|
result);
|
||||||
|
return result;
|
||||||
|
}).catch(function(response) {
|
||||||
|
var errorMessage = 'Failed to get: ' + url + ' GET returned: ' + status;
|
||||||
|
|
||||||
|
ProcessErrors(null,
|
||||||
|
response.data,
|
||||||
|
response.status,
|
||||||
|
null, {
|
||||||
|
hdr: 'Error!',
|
||||||
|
msg: errorMessage
|
||||||
|
});
|
||||||
|
return response;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -71,6 +71,17 @@ describe('Job Status Graph Data Service', function() {
|
|||||||
return expect(result).to.eventually.equal(firstResult);;
|
return expect(result).to.eventually.equal(firstResult);;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('processes errors through error handler', function() {
|
||||||
|
var expected = { data: "error", status: "bad" };
|
||||||
|
var actual = jobStatusGraphData.get();
|
||||||
|
|
||||||
|
restStub.fail(expected);
|
||||||
|
|
||||||
|
flushPromises();
|
||||||
|
|
||||||
|
return expect(actual).to.be.rejectedWith(expected);
|
||||||
|
});
|
||||||
|
|
||||||
it('broadcasts event when data is received', function() {
|
it('broadcasts event when data is received', function() {
|
||||||
var expected = "value";
|
var expected = "value";
|
||||||
var result = q.defer();
|
var result = q.defer();
|
||||||
@@ -88,7 +99,4 @@ describe('Job Status Graph Data Service', function() {
|
|||||||
return expect(result.promise).to.eventually.equal(expected);
|
return expect(result.promise).to.eventually.equal(expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
xit('processes errors through error handler', function() {
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user