X-Git-Url: https://git.cweiske.de/grauphel.git/blobdiff_plain/0c9b45d210a5d94b3ba219e32b73233a5a795f61..e74217a7bbd58cf76963c15c73221669e1153510:/controller/guicontroller.php?ds=inline diff --git a/controller/guicontroller.php b/controller/guicontroller.php index fc97b04..b09ef4a 100644 --- a/controller/guicontroller.php +++ b/controller/guicontroller.php @@ -59,7 +59,18 @@ class GuiController extends Controller */ public function index() { - $this->checkDeps(); + try { + $this->checkDeps(); + } catch (\Exception $e) { + $res = new TemplateResponse('grauphel', 'error'); + $res->setParams( + array( + 'message' => $e->getMessage(), + 'code' => $e->getCode(), + ) + ); + return $res; + } $res = new TemplateResponse('grauphel', 'index'); $res->setParams( @@ -88,14 +99,26 @@ class GuiController extends Controller return new ErrorResponse('Note does not exist'); } - $converter = new \OCA\Grauphel\Lib\Converter\Html(); + $converter = new \OCA\Grauphel\Converter\Html(); $converter->internalLinkHandler = array($this, 'noteLinkHandler'); + + try { + $contentHtml = $converter->convert($note->{'note-content'}); + } catch (\OCA\Grauphel\Converter\Exception $e) { + $contentHtml = '
There was an error converting the note to HTML:
' + . '' . htmlspecialchars($e->getMessage()) . '' + . '
Please open a bug report at' + . ' ' + . 'github.com/cweiske/grauphel/issues' + . ' and attach the XML version of the note.' + . '