Fixed an issue in schema diff where an error message popup was showing some garbage without any info. #8098
parent
88e515093c
commit
cd2f48aeb1
|
@ -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')));
|
||||||
|
|
Loading…
Reference in New Issue