Fixed issues introduce by SonarQube fixes.

This commit is contained in:
Akshay Joshi
2022-02-01 14:11:18 +05:30
parent 21359c6c74
commit aa5b1d50b9
6 changed files with 27 additions and 36 deletions

View File

@@ -116,10 +116,14 @@ export default class SchemaDiffUI {
raise_error_on_fail(alert_title, xhr) {
try {
var err = JSON.parse(xhr.responseText);
Notify.alert(alert_title, err.errormsg);
if (_.isUndefined(xhr.responseText)) {
Notify.alert(alert_title, gettext('Unable to get the response text.'));
} else {
var err = JSON.parse(xhr.responseText);
Notify.alert(alert_title, err.errormsg);
}
} catch (e) {
Notify.alert(alert_title, e.statusText);
Notify.alert(alert_title, gettext(e.message));
}
}