Ensure that the correct error message in ERD for permission denied should be shown. #5537

pull/5546/head
Aditya Toshniwal 2022-11-16 14:37:54 +05:30 committed by GitHub
parent 749138791a
commit 2ab5d2b647
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

View File

@ -40,6 +40,9 @@ export function parseApiError(error) {
} else if(error.message) {
// Something happened in setting up the request that triggered an Error
return error.message;
} else if(error.errormsg) {
// Received response JSON in socket handle
return error.errormsg;
} else {
return error;
}

View File

@ -10,7 +10,7 @@
"""A blueprint module implementing the erd tool."""
import simplejson as json
from flask import url_for, request
from flask import url_for, request, Response
from flask import render_template, current_app as app
from flask_security import login_required
from flask_babel import gettext
@ -640,10 +640,11 @@ def tables(params):
params.get('tid', None))
if not status:
tables = tables.json if type(tables) == Response else tables
socketio.emit('tables_failed', tables,
namespace=SOCKETIO_NAMESPACE,
to=request.sid)
return internal_server_error(errormsg=tables)
return
socketio.emit('tables_success', tables, namespace=SOCKETIO_NAMESPACE,
to=request.sid)
except Exception as e:

View File

@ -286,8 +286,7 @@ class ERDTool extends React.Component {
}
handleAxiosCatch(err) {
console.error(err);
Notify.alert(gettext('Error'), parseApiError(err));
this.context.alert(gettext('Error'), parseApiError(err));
}
async componentDidMount() {