From: Richard Heck Date: Sat, 17 Apr 2010 22:36:31 +0000 (+0000) Subject: Fix crash reported by Bennett. We could try to catch these exceptions X-Git-Tag: 2.0.0~3429 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=dcc7497bde2385ebc6c9fe0365f2be1ebc63218e;p=features.git 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 --- diff --git a/src/TextClass.cpp b/src/TextClass.cpp index 030e1601e7..3aebbbd638 100644 --- a/src/TextClass.cpp +++ b/src/TextClass.cpp @@ -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; diff --git a/src/tex2lyx/tex2lyx.cpp b/src/tex2lyx/tex2lyx.cpp index b6e8aee555..bb4578d5bc 100644 --- a/src/tex2lyx/tex2lyx.cpp +++ b/src/tex2lyx/tex2lyx.cpp @@ -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 &) diff --git a/src/tex2lyx/tex2lyx.h b/src/tex2lyx/tex2lyx.h index 3ca64d2193..52cf2c6ffe 100644 --- a/src/tex2lyx/tex2lyx.h +++ b/src/tex2lyx/tex2lyx.h @@ -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