Adjust edit template controller to handle deferred promise errors

This commit is contained in:
kialam 2018-08-01 10:36:07 -04:00
parent 21f29983bb
commit 21c364d14c

View File

@ -588,6 +588,19 @@ export default
.then(function() {
Wait('stop');
saveCompleted();
})
.catch(err => {
// Handle any potential errors
let { data, status, config } = err;
const { url } = config;
// Handle edge case for LABELS endpoint
const labelName = "labels";
if (url.match(labelName)) {
data = { [labelName]: [data['name'][0]] };
}
ProcessErrors($scope, data, status, form, { hdr: 'Error!',
msg: 'Failed to update job template. PUT returned status: ' + status });
});
});
});