mirror of
https://github.com/apache/superset.git
synced 2024-09-17 11:09:47 -04:00
fix: better error messages for dashboard properties modal (#11382)
This commit is contained in:
parent
59885c4dea
commit
2227b13b52
@ -202,13 +202,25 @@ class PropertiesModal extends React.PureComponent {
|
||||
}
|
||||
|
||||
async handleErrorResponse(response) {
|
||||
const { error, statusText } = await getClientErrorObject(response);
|
||||
const { error, statusText, message } = await getClientErrorObject(response);
|
||||
let errorText = error || statusText || t('An error has occurred');
|
||||
|
||||
if (typeof message === 'object' && message.json_metadata) {
|
||||
errorText = message.json_metadata;
|
||||
} else if (typeof message === 'string') {
|
||||
errorText = message;
|
||||
|
||||
if (message === 'Forbidden') {
|
||||
errorText = t('You do not have permission to edit this dashboard');
|
||||
}
|
||||
}
|
||||
|
||||
this.dialog.show({
|
||||
title: 'Error',
|
||||
bsSize: 'medium',
|
||||
bsStyle: 'danger',
|
||||
actions: [Dialog.DefaultAction('Ok', () => {}, 'btn-danger')],
|
||||
body: error || statusText || t('An error has occurred'),
|
||||
body: errorText,
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user