Tpl::display(): add success event info on success hook and fix triggering it (and sentry span finish) on error

This commit is contained in:
Benjamin Renard 2023-02-27 18:53:40 +01:00
parent de0763c5f6
commit 3742ce7448
Signed by: bn8
GPG key ID: 3E2E1CE1907115BC

View file

@ -432,13 +432,15 @@ class Tpl {
} }
catch (Exception $e) { catch (Exception $e) {
Log :: exception($e, "Smarty - An exception occured displaying template '$template'"); Log :: exception($e, "Smarty - An exception occured displaying template '$template'");
Hook :: trigger('after_displaying_template', array('success' => false));
$sentry_span->finish();
if ($template != 'fatal_error.tpl') if ($template != 'fatal_error.tpl')
Log :: fatal(I18n::_("An error occurred while displaying this page.")); Log :: fatal(I18n::_("An error occurred while displaying this page."));
return; return;
} }
self :: purge_errors(); self :: purge_errors();
self :: purge_messages(); self :: purge_messages();
Hook :: trigger('after_displaying_template'); Hook :: trigger('after_displaying_template', array('success' => true));
$sentry_span->finish(); $sentry_span->finish();
} }