- case LFUN_TEXTCLASS_LOAD:
- LayoutFileList::get().load(argument, buffer_.temppath()) ||
- LayoutFileList::get().load(argument, buffer_.filePath());
+ case LFUN_TEXTCLASS_LOAD: {
+ // since this shortcircuits, the second call is made only if
+ // the first fails
+ bool const success =
+ LayoutFileList::get().load(argument, buffer_.temppath()) ||
+ LayoutFileList::get().load(argument, buffer_.filePath());
+ if (!success) {
+ docstring s = bformat(_("The document class `%1$s' "
+ "could not be loaded."), from_utf8(argument));
+ frontend::Alert::error(_("Could not load class"), s);
+ }