Give a more useful error message if attempting to drop an object that doesn't exist. Fixes #1154

This commit is contained in:
Harshal Dhumal
2016-07-26 14:40:02 +01:00
committed by Dave Page
parent d3d96d5c05
commit 166d42953c
31 changed files with 342 additions and 13 deletions

View File

@@ -430,6 +430,18 @@ class ResourceGroupView(NodeView):
status, rgname = self.conn.execute_scalar(sql)
if not status:
return internal_server_error(errormsg=rgname)
if rgname is None:
return make_json_response(
success=0,
errormsg=gettext(
'Error: Object not found.'
),
info=gettext(
'The specified resource group could not be found.\n'
)
)
# drop resource group
sql = render_template("/".join([self.template_path, 'delete.sql']), rgname=rgname, conn=self.conn)
status, res = self.conn.execute_scalar(sql)