FIX: Broken error reporting in modals (and other places) (#23680)

1. actually call `popupAjaxError`, thanks :P
2. don't close a modal on error
3. use `extractError()` instead of manually joining error messages
4. …or passing just the error object to `this.flash`
This commit is contained in:
Jarek Radosz
2023-09-27 17:11:44 +02:00
committed by GitHub
parent 1ad60b791c
commit 6adc67a7a8
11 changed files with 70 additions and 58 deletions

View File

@ -4,6 +4,7 @@ import { tracked } from "@glimmer/tracking";
import I18n from "I18n";
import { ajax } from "discourse/lib/ajax";
import { isEmpty } from "@ember/utils";
import { extractError } from "discourse/lib/ajax-error";
const THEME_FIELD_VARIABLE_TYPE_IDS = [2, 3, 4];
const SCSS_VARIABLE_NAMES = [
@ -108,7 +109,7 @@ export default class ThemeUploadAdd extends Component {
this.args.model.addUpload(upload);
this.args.closeModal();
} catch (e) {
this.flash = e.jqXHR.responseJSON.errors.join(". ");
this.flash = extractError(e);
}
}
}