Fixed an issue where utilities such as pg_dump and pg_restore failed to log error messages when required dependency files were missing. #7466
parent
0a2db9bc59
commit
a3e43e4e97
|
@ -29,5 +29,6 @@ Bug fixes
|
|||
*********
|
||||
|
||||
| `Issue #6118 <https://github.com/pgadmin-org/pgadmin4/issues/6118>`_ - Improved PL/pgSQL code folding and support nested blocks.
|
||||
| `Issue #7466 <https://github.com/pgadmin-org/pgadmin4/issues/7466>`_ - Fixed an issue where utilities such as pg_dump and pg_restore failed to log error messages when required dependency files were missing.
|
||||
| `Issue #8032 <https://github.com/pgadmin-org/pgadmin4/issues/8032>`_ - Fixed an issue where the Schema Diff Tool incorrectly reported differences due to variations in the order of the privileges.
|
||||
| `Issue #8691 <https://github.com/pgadmin-org/pgadmin4/issues/8691>`_ - Fixed an issue in the query tool where using multiple cursors to copy text resulted in only the first line being copied.
|
||||
|
|
|
@ -25,7 +25,8 @@ import shutil
|
|||
|
||||
from pgadmin.utils import u_encode, file_quote, fs_encoding, \
|
||||
get_complete_file_path, get_storage_directory, IS_WIN
|
||||
from pgadmin.utils.constants import KERBEROS
|
||||
from pgadmin.utils.constants import (KERBEROS, UTILITIES_ARRAY,
|
||||
BG_PROCESS_ERROR_MSGS)
|
||||
from pgadmin.utils.locker import ConnectionLocker
|
||||
from pgadmin.utils.preferences import Preferences
|
||||
|
||||
|
@ -45,6 +46,26 @@ PROCESS_TERMINATED = 3
|
|||
PROCESS_NOT_FOUND = _("Could not find a process with the specified ID.")
|
||||
|
||||
|
||||
def get_error_msg(cmd, error_code):
|
||||
"""
|
||||
This function is used to get the error message based on exit code.
|
||||
"""
|
||||
error_str = ''
|
||||
# Get the Utility from the cmd.
|
||||
for utility in UTILITIES_ARRAY:
|
||||
if utility in cmd:
|
||||
error_str = utility + _(': error: ')
|
||||
break
|
||||
|
||||
try:
|
||||
error_str = error_str + BG_PROCESS_ERROR_MSGS[error_code]
|
||||
except KeyError:
|
||||
error_str = (error_str + _('utility failed with exit code: ') +
|
||||
str(error_code))
|
||||
|
||||
return error_str
|
||||
|
||||
|
||||
def get_current_time(format='%Y-%m-%d %H:%M:%S.%f %z'):
|
||||
"""
|
||||
Generate the current time string in the given format.
|
||||
|
@ -608,6 +629,12 @@ class BatchProcess:
|
|||
'process_state': self.process_state
|
||||
}
|
||||
|
||||
# Get the error message based on exit code.
|
||||
if err_completed and self.ecode != 0:
|
||||
err_msg = get_error_msg(self.cmd, self.ecode)
|
||||
# This should be the last line as added 'Z' for sorting.
|
||||
stderr.append(['Z', err_msg])
|
||||
|
||||
return {
|
||||
'out': {
|
||||
'pos': out,
|
||||
|
|
|
@ -115,7 +115,13 @@ BINARY_PATHS = {
|
|||
]
|
||||
}
|
||||
|
||||
UTILITIES_ARRAY = ['pg_dump', 'pg_dumpall', 'pg_restore', 'psql']
|
||||
UTILITIES_ARRAY = ['pg_dumpall', 'pg_dump', 'pg_restore', 'psql']
|
||||
|
||||
BG_PROCESS_ERROR_MSGS = {
|
||||
3221225781: gettext('Unable to find a dll needed by the utility. Ensure '
|
||||
'.dll files needed by the utility are in the same '
|
||||
'folder as your executable.')
|
||||
}
|
||||
|
||||
ENTER_EMAIL_ADDRESS = "Email address: "
|
||||
USER_NOT_FOUND = gettext("The specified user ID (%s) could not be found.")
|
||||
|
|
Loading…
Reference in New Issue