Fixed #272 (error message if macro interpreter isn't available)

This commit is contained in:
Matthias Koefferlein 2019-06-18 02:03:54 +02:00
parent f59e49d678
commit 9d7c8d31fc
1 changed files with 5 additions and 3 deletions

View File

@ -1014,7 +1014,7 @@ bool Macro::can_run () const
int Macro::run () const int Macro::run () const
{ {
if (tl::verbosity () >= 20) { if (tl::verbosity () >= 20) {
tl::log << "Running macro " << path (); tl::log << tl::to_string (tr ("Running macro ")) << path ();
} }
try { try {
@ -1029,6 +1029,8 @@ int Macro::run () const
} }
} else if (interpreter () == lym::Macro::DSLInterpreter) { } else if (interpreter () == lym::Macro::DSLInterpreter) {
lym::MacroInterpreter::execute_macro (this); lym::MacroInterpreter::execute_macro (this);
} else {
throw tl::Exception (tl::to_string (tr ("Can't run macro (no interpreter): ")) + path ());
} }
} catch (tl::ExitException &ex) { } catch (tl::ExitException &ex) {
return ex.status (); return ex.status ();
@ -1843,10 +1845,10 @@ static void autorun_for (lym::MacroCollection &collection, bool early)
} }
for (lym::MacroCollection::iterator c = collection.begin (); c != collection.end (); ++c) { for (lym::MacroCollection::iterator c = collection.begin (); c != collection.end (); ++c) {
if (((early && c->second->is_autorun_early ()) || (!early && c->second->is_autorun () && !c->second->is_autorun_early ())) && c->second->can_run ()) { if ((early && c->second->is_autorun_early ()) || (!early && c->second->is_autorun () && !c->second->is_autorun_early ())) {
BEGIN_PROTECTED_SILENT BEGIN_PROTECTED_SILENT
c->second->install_doc ();
c->second->run (); c->second->run ();
c->second->install_doc ();
END_PROTECTED_SILENT END_PROTECTED_SILENT
} }
} }