From 03c07c0843db8732d6905e4f9bb0fd15f1c2be87 Mon Sep 17 00:00:00 2001 From: mabashian Date: Wed, 27 Feb 2019 10:07:47 -0500 Subject: [PATCH] Adds error handling to launch api calls --- .../launchTemplateButton.component.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/awx/ui/client/lib/components/launchTemplateButton/launchTemplateButton.component.js b/awx/ui/client/lib/components/launchTemplateButton/launchTemplateButton.component.js index fe0dfa0f9a..60a56df3fd 100644 --- a/awx/ui/client/lib/components/launchTemplateButton/launchTemplateButton.component.js +++ b/awx/ui/client/lib/components/launchTemplateButton/launchTemplateButton.component.js @@ -56,7 +56,8 @@ function atLaunchTemplateCtrl ( } else { $state.go('output', { id: data.job, type: 'playbook' }, { reload: true }); } - }); + }) + .catch(createErrorHandler('launch job template', 'POST')); } else { const promptData = { launchConf: launchData.data, @@ -78,12 +79,14 @@ function atLaunchTemplateCtrl ( }); promptData.surveyQuestions = processed.surveyQuestions; vm.promptData = promptData; - }); + }) + .catch(createErrorHandler('get survey questions', 'GET')); } else { vm.promptData = promptData; } } - }); + }) + .catch(createErrorHandler('get launch options', 'GET')); } else if (vm.template.type === 'workflow_job_template') { const selectedWorkflowJobTemplate = workflowTemplate.create(); const preLaunchPromises = [ @@ -99,7 +102,8 @@ function atLaunchTemplateCtrl ( .postLaunch({ id: vm.template.id }) .then(({ data }) => { $state.go('workflowResults', { id: data.workflow_job }, { reload: true }); - }); + }) + .catch(createErrorHandler('launch workflow job template', 'POST')); } else { launchData.data.defaults.extra_vars = wfjtData.data.extra_vars; @@ -128,7 +132,8 @@ function atLaunchTemplateCtrl ( vm.promptData = promptData; } } - }); + }) + .catch(createErrorHandler('get launch options', 'GET')); } else { Alert(templatesStrings.get('error.UNKNOWN'), templatesStrings.get('alert.UNKNOWN_LAUNCH')); }