Fix crash reported by Bennett. We could try to catch these exceptions

elsewhere, but I actually don't know why I put them here in the first
place.

The tex2lyx stuff allows us not to wrap the calls to
frontend::Alert::warning in "#ifdef TEX2LYX" blocks.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34192 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-04-17 22:36:31 +00:00
parent aeac2f8cb9
commit dcc7497bde
3 changed files with 23 additions and 4 deletions

View File

@ -1278,8 +1278,7 @@ DocumentClass & DocumentClassBundle::makeDocumentClass(
"this document but has not been found in the list of\n"
"available modules. If you recently installed it, you\n"
"probably need to reconfigure LyX.\n"), from_utf8(modName));
throw ExceptionMessage(WarningException,_("Module not available"),
msg + _("Some layouts may not be available."));
frontend::Alert::warning(_("Module not available"), msg);
continue;
}
if (!lm->isAvailable()) {
@ -1287,13 +1286,13 @@ DocumentClass & DocumentClassBundle::makeDocumentClass(
bformat(_("The module %1$s requires a package that is\n"
"not available in your LaTeX installation. LaTeX output\n"
"may not be possible.\n"), from_utf8(modName));
throw ExceptionMessage(WarningException, _("Package not available"), msg);
frontend::Alert::warning(_("Package not available"), msg);
}
FileName layout_file = libFileSearch("layouts", lm->getFilename());
if (!doc_class.read(layout_file, TextClass::MODULE)) {
docstring const msg =
bformat(_("Error reading module %1$s\n"), from_utf8(modName));
throw ExceptionMessage(WarningException, _("Read Error"), msg);
frontend::Alert::warning(_("Read Error"), msg);
}
}
return doc_class;

View File

@ -42,6 +42,18 @@ using namespace lyx::support::os;
namespace lyx {
namespace frontend {
namespace Alert {
void warning(docstring const & title, docstring const & message,
bool const &)
{
LYXERR0(title);
LYXERR0(message);
}
}
}
// Dummy translation support
Messages messages_;
Messages const & getMessages(std::string const &)

View File

@ -26,6 +26,14 @@ namespace lyx {
namespace support { class FileName; }
/// Simple support for frontend::Alert::warning().
namespace frontend {
namespace Alert {
void warning(docstring const & title, docstring const & message,
bool const &);
}
}
class Context;
/// A trivial subclass, just to give us a public default constructor