Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions web/pgadmin/static/js/socket_instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down Expand Up @@ -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')));
Expand Down
Loading