SyncruleController: fail nicely in preview

fixes #1941
This commit is contained in:
Thomas Gelf 2019-09-16 11:37:44 +02:00
parent 5304be4ec0
commit ab109ab626
1 changed files with 11 additions and 1 deletions

View File

@ -160,7 +160,17 @@ class SyncruleController extends ActionController
$this->tabs(new SyncRuleTabs($rule))->activate('preview'); $this->tabs(new SyncRuleTabs($rule))->activate('preview');
$this->addTitle('Sync Preview'); $this->addTitle('Sync Preview');
$sync = new Sync($rule); $sync = new Sync($rule);
try {
$modifications = $sync->getExpectedModifications(); $modifications = $sync->getExpectedModifications();
} catch (\Exception $e) {
$this->content()->add(
Html::tag('p', [
'class' => 'error'
], $e->getMessage())
);
return;
}
if (empty($modifications)) { if (empty($modifications)) {
$this->content()->add(Html::tag('p', [ $this->content()->add(Html::tag('p', [