mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Standardise the error handling for parsing of JSON response messages from the server. Fixes #3238
This commit is contained in:
@@ -175,24 +175,8 @@ define('pgadmin.node.pga_job', [
|
||||
// 'pgagent.pga_job' table updated with current time to run the job
|
||||
// now.
|
||||
success: function() { t.unload(i); },
|
||||
error: function(xhr) {
|
||||
var error_msg = gettext('Unable to run pgagent job.');
|
||||
if (xhr.readyState == 0) {
|
||||
alertify.error(
|
||||
gettext('Not connected to the server or the connection to the server has been closed.')
|
||||
);
|
||||
}
|
||||
else {
|
||||
if (_.isUndefined(xhr.responseText)) {
|
||||
alertify.error(error_msg);
|
||||
}
|
||||
else {
|
||||
var err = $.parseJSON(xhr.responseText);
|
||||
if (err.success == 0) {
|
||||
alertify.error(err.errormsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
error: function(xhr, status, error) {
|
||||
alertify.pgRespErrorNotify(xhr, error);
|
||||
t.unload(i);
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user