Ensure that proper error should be displayed for the deleted node. Fixes #3669

This commit is contained in:
Satish V
2020-06-03 11:26:26 +05:30
committed by Akshay Joshi
parent 3d0319dba7
commit d22e276586
24 changed files with 186 additions and 52 deletions

View File

@@ -21,6 +21,7 @@ from pgadmin.tools.sqleditor.utils.is_query_resultset_updatable \
from pgadmin.tools.sqleditor.utils.save_changed_data import save_changed_data
from pgadmin.tools.sqleditor.utils.get_column_types import get_columns_types
from pgadmin.utils.preferences import Preferences
from web.pgadmin.utils.exception import ObjectGone
from config import PG_DEFAULT_DRIVER
@@ -187,6 +188,9 @@ class SQLFilter(object):
status, result = conn.execute_dict(query)
if not status:
raise Exception(result)
if len(result['rows']) == 0:
raise ObjectGone(
gettext("The specified object could not be found."))
self.nsp_name = result['rows'][0]['nspname']
self.object_name = result['rows'][0]['relname']

View File

@@ -2107,9 +2107,18 @@ define('tools.querytool', [
'pgadmin:query_tool:connected:' + self.transId, res.data
);
}).fail((xhr, status, error)=>{
pgBrowser.Events.trigger(
'pgadmin:query_tool:connected_fail:' + self.transId, xhr, error
);
if (xhr.status === 410) {
//checking for Query tool in new window.
if(self.preferences.new_browser_tab) {
pgBrowser.report_error(gettext('Error fetching rows - %s.', xhr.statusText), xhr.responseJSON.errormsg, undefined, window.close);
} else {
pgBrowser.report_error(gettext('Error fetching rows - %s.', xhr.statusText), xhr.responseJSON.errormsg, undefined, self.close.bind(self));
}
} else {
pgBrowser.Events.trigger(
'pgadmin:query_tool:connected_fail:' + self.transId, xhr, error
);
}
});
},
@@ -2316,10 +2325,14 @@ define('tools.querytool', [
msg = httpErrorHandler.handleQueryToolAjaxError(
pgAdmin, self, jqx, null, [], false
);
if (msg)
pgBrowser.report_error(
gettext('Error fetching SQL for script: %s.', msg)
);
if (msg) {
if(self.preferences.new_browser_tab) {
pgBrowser.report_error(gettext('Error fetching SQL for script - %s.', jqx.statusText), jqx.responseJSON.errormsg, undefined, window.close);
} else {
pgBrowser.report_error(gettext('Error fetching SQL for script - %s.', jqx.statusText), jqx.responseJSON.errormsg, undefined, self.close.bind(self));
}
}
});
}
}