Fixed an issue in schema diff where an error message popup was showing some garbage without any info. #8098

pull/8187/head
Anil Sahoo 2024-11-28 10:16:41 +05:30 committed by GitHub
parent 88e515093c
commit cd2f48aeb1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 2 deletions

View File

@ -9,7 +9,7 @@
import { io } from 'socketio'; import { io } from 'socketio';
import gettext from 'sources/gettext'; import gettext from 'sources/gettext';
import url_for from 'sources/url_for'; import url_for from 'sources/url_for';
import { parseApiError } from './api_instance';
export function openSocket(namespace, options) { export function openSocket(namespace, options) {
return new Promise((resolve, reject)=>{ return new Promise((resolve, reject)=>{
const socketObj = io(namespace, { const socketObj = io(namespace, {
@ -42,7 +42,9 @@ export function socketApiGet(socket, endpoint, params) {
resolve(data); resolve(data);
}); });
socket.on(`${endpoint}_failed`, (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', ()=>{ socket.on('disconnect', ()=>{
reject(new Error(gettext('Connection to pgAdmin server has been lost'))); reject(new Error(gettext('Connection to pgAdmin server has been lost')));