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

This commit is contained in:
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

View File

@ -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')));