From ab7b13b664bf54842c34c2be583dad51ccd78dcf Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Tue, 18 Nov 2014 12:53:43 +0100 Subject: [PATCH] bug #3363: rescue exception when trying to parse a plain service template --- src/sunstone/public/js/plugins/oneflow-templates.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sunstone/public/js/plugins/oneflow-templates.js b/src/sunstone/public/js/plugins/oneflow-templates.js index e52c3f3f2b..a4b1a90311 100644 --- a/src/sunstone/public/js/plugins/oneflow-templates.js +++ b/src/sunstone/public/js/plugins/oneflow-templates.js @@ -1390,7 +1390,12 @@ function initialize_create_service_template_dialog(dialog){ }).on('valid', function() { if ($('#create_service_template_form_advanced',dialog).attr("action") == "create") { var json_template = $("#template", this).val(); - Sunstone.runAction("ServiceTemplate.create", JSON.parse(json_template) ); + try { + Sunstone.runAction("ServiceTemplate.create", JSON.parse(json_template) ); + } catch(e) { + popFormDialog("create_service_template_form", $("#oneflow-templates")); + notifyError(e); + } return false; } else if ($('#create_service_template_form_advanced',dialog).attr("action") == "update") { var json_template = $("#template", this).val();