mirror of
https://github.com/ansible/awx.git
synced 2026-01-19 13:41:28 -03:30
Add error handling to retrieval service
This commit is contained in:
parent
d7a150befe
commit
e0efc11ef5
@ -22,6 +22,18 @@ function JobStatusGraphData(Rest, getBasePath, processErrors, $rootScope, $q) {
|
||||
$rootScope.
|
||||
$broadcast('DataReceived:JobStatusGraph',
|
||||
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);;
|
||||
});
|
||||
|
||||
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() {
|
||||
var expected = "value";
|
||||
var result = q.defer();
|
||||
@ -88,7 +99,4 @@ describe('Job Status Graph Data Service', function() {
|
||||
return expect(result.promise).to.eventually.equal(expected);
|
||||
});
|
||||
|
||||
xit('processes errors through error handler', function() {
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user