From cd2f48aeb1e3244ca3134e4f93b72b309d35d785 Mon Sep 17 00:00:00 2001 From: Anil Sahoo Date: Thu, 28 Nov 2024 10:16:41 +0530 Subject: [PATCH] Fixed an issue in schema diff where an error message popup was showing some garbage without any info. #8098 --- web/pgadmin/static/js/socket_instance.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/web/pgadmin/static/js/socket_instance.js b/web/pgadmin/static/js/socket_instance.js index 512368511..4a6645632 100644 --- a/web/pgadmin/static/js/socket_instance.js +++ b/web/pgadmin/static/js/socket_instance.js @@ -9,7 +9,7 @@ import { io } from 'socketio'; import gettext from 'sources/gettext'; import url_for from 'sources/url_for'; - +import { parseApiError } from './api_instance'; export function openSocket(namespace, options) { return new Promise((resolve, reject)=>{ const socketObj = io(namespace, { @@ -42,7 +42,9 @@ export function socketApiGet(socket, endpoint, params) { resolve(data); }); socket.on(`${endpoint}_failed`, (data)=>{ - reject(new Error(data)); + /* when data comes in JSON format, + that must be parsed to only error message */ + reject(new Error(parseApiError(data))); }); socket.on('disconnect', ()=>{ reject(new Error(gettext('Connection to pgAdmin server has been lost')));