mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 19:10:07 -03:30
Handle errors with ProcessErrors
This commit is contained in:
parent
cee81e9df6
commit
32da686724
@ -275,8 +275,11 @@ export default
|
||||
}));
|
||||
$scope.credential_types = credential_types;
|
||||
})
|
||||
.catch( (error) => {
|
||||
console.log(error);
|
||||
.catch(({data, status}) => {
|
||||
ProcessErrors($scope, data, status, null, {
|
||||
hdr: 'Error!',
|
||||
msg: 'Failed to get credential types. GET status: ' + status
|
||||
});
|
||||
});
|
||||
|
||||
// Figure out which step the user needs to start on
|
||||
|
||||
@ -116,7 +116,7 @@
|
||||
|
||||
function retrieveStatus(id) {
|
||||
setTimeout(function() {
|
||||
var url = GetBasePath('notifications') + id;
|
||||
let url = GetBasePath('notifications') + id;
|
||||
Rest.setUrl(url);
|
||||
Rest.get()
|
||||
.then(function(res) {
|
||||
@ -142,9 +142,12 @@
|
||||
}
|
||||
|
||||
})
|
||||
.catch( (error) => {
|
||||
console.log(error);
|
||||
})
|
||||
.catch(({data, status}) => {
|
||||
ProcessErrors($scope, data, status, null, {
|
||||
hdr: 'Error!',
|
||||
msg: 'Failed to get ' + url + '. GET status: ' + status
|
||||
});
|
||||
});
|
||||
}, 5000);
|
||||
}
|
||||
};
|
||||
|
||||
@ -61,7 +61,7 @@ export default
|
||||
ParentObject: ['$stateParams', 'Rest', 'GetBasePath', function($stateParams, Rest, GetBasePath){
|
||||
let path = `${GetBasePath('job_templates')}${$stateParams.id}`;
|
||||
Rest.setUrl(path);
|
||||
return Rest.get(path).then(response => response.data)
|
||||
return Rest.get(path).then(response => response.data);
|
||||
}],
|
||||
UnifiedJobsOptions: ['Rest', 'GetBasePath', '$stateParams', '$q',
|
||||
function(Rest, GetBasePath, $stateParams, $q) {
|
||||
@ -152,7 +152,7 @@ export default
|
||||
ParentObject: ['$stateParams', 'Rest', 'GetBasePath', function($stateParams, Rest, GetBasePath){
|
||||
let path = `${GetBasePath('workflow_job_templates')}${$stateParams.id}`;
|
||||
Rest.setUrl(path);
|
||||
return Rest.get(path).then(response => response.data)
|
||||
return Rest.get(path).then(response => response.data);
|
||||
}],
|
||||
UnifiedJobsOptions: ['Rest', 'GetBasePath', '$stateParams', '$q',
|
||||
function(Rest, GetBasePath, $stateParams, $q) {
|
||||
@ -242,7 +242,7 @@ export default
|
||||
ParentObject: ['$stateParams', 'Rest', 'GetBasePath', function($stateParams, Rest, GetBasePath){
|
||||
let path = `${GetBasePath('projects')}${$stateParams.id}`;
|
||||
Rest.setUrl(path);
|
||||
return Rest.get(path).then(response => response.data)
|
||||
return Rest.get(path).then(response => response.data);
|
||||
}],
|
||||
UnifiedJobsOptions: ['Rest', 'GetBasePath', '$stateParams', '$q',
|
||||
function(Rest, GetBasePath, $stateParams, $q) {
|
||||
|
||||
@ -22,7 +22,8 @@ export default
|
||||
if (data.actions.POST) {
|
||||
canAddVal.resolve({canAdd: true, options: data});
|
||||
} else {
|
||||
canAddVal.resolve({canAdd: false}) }
|
||||
canAddVal.resolve({canAdd: false});
|
||||
}
|
||||
Wait("stop");
|
||||
});
|
||||
|
||||
|
||||
@ -99,8 +99,7 @@ export default
|
||||
}
|
||||
})
|
||||
.catch( (error) => {
|
||||
console.log(error);
|
||||
if (status_code === 403) {
|
||||
if (error.status_code === 403) {
|
||||
/* user doesn't have access to see the project, no big deal. */
|
||||
$scope.disablePlaybookBecausePermissionDenied = true;
|
||||
} else {
|
||||
@ -144,9 +143,12 @@ export default
|
||||
.then(function(){
|
||||
Wait('stop');
|
||||
})
|
||||
.catch( (error) => {
|
||||
console.log(error);
|
||||
})
|
||||
.catch(({data, status}) => {
|
||||
ProcessErrors($scope, data, status, null, {
|
||||
hdr: 'Error!',
|
||||
msg: 'Call failed. Returned status: ' + status
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -210,13 +210,15 @@ export default ['$scope', '$rootScope',
|
||||
$state.go('templates.editJobTemplate', {job_template_id: results.id}, {reload: true});
|
||||
}
|
||||
})
|
||||
.catch((error)=> {
|
||||
console.log(error);
|
||||
})
|
||||
.catch(({data, status}) => {
|
||||
ProcessErrors($scope, data, status, null, {
|
||||
hdr: 'Error!',
|
||||
msg: 'Call failed. Return status: ' + status
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
ProcessErrors($rootScope, error, status, null, {hdr: 'Error!',
|
||||
.catch(({data, status}) => {
|
||||
ProcessErrors($rootScope, data, status, null, {hdr: 'Error!',
|
||||
msg: 'Call failed. Return status: '+ status});
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user