Prevent invalid LESS from crashing application

Failure is silent for now... The default LESS will compile without the
invalid customisations. Not sure if we should log an error somewhere
and display it on the admin page?

closes #400
This commit is contained in:
Toby Zerner 2015-09-04 22:33:26 +09:30
parent 478ca90c31
commit 6ee9412f35

View File

@ -11,6 +11,7 @@
namespace Flarum\Assets;
use Less_Parser;
use Less_Exception_Parser;
class LessCompiler extends RevisionCompiler
{
@ -28,7 +29,11 @@ class LessCompiler extends RevisionCompiler
}
foreach ($this->strings as $callback) {
$parser->parse($callback());
try {
$parser->parse($callback());
} catch (Less_Exception_Parser $e) {
// TODO: log an error somewhere?
}
}
return $parser->getCss();