Url: add before_handling_request & after_handling_request hooks
This commit is contained in:
parent
f16f433326
commit
7f2644b46a
1 changed files with 10 additions and 2 deletions
10
src/Url.php
10
src/Url.php
|
@ -454,16 +454,24 @@ class Url {
|
||||||
if(self :: $request -> authenticated && !Auth::login(true))
|
if(self :: $request -> authenticated && !Auth::login(true))
|
||||||
Log :: fatal(I18n::_("Authentication required but fail to authenticate you."));
|
Log :: fatal(I18n::_("Authentication required but fail to authenticate you."));
|
||||||
|
|
||||||
|
Hook::trigger('before_handling_request', array('request' => self :: $request));
|
||||||
|
$success = false;
|
||||||
try {
|
try {
|
||||||
call_user_func(self :: $request -> handler, self :: $request);
|
call_user_func(self :: $request -> handler, self :: $request);
|
||||||
|
$success = true;
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
Log :: exception(
|
Log :: exception(
|
||||||
$e, "An exception occured running URL handler %s",
|
$e, "An exception occured running URL handler %s",
|
||||||
format_callable(self :: $request -> handler));
|
format_callable(self :: $request -> handler));
|
||||||
Log :: fatal(I18n::_("This request could not be processed correctly."));
|
|
||||||
}
|
}
|
||||||
|
Hook::trigger(
|
||||||
|
'after_handling_request',
|
||||||
|
array('request' => self :: $request, 'success' => $success)
|
||||||
|
);
|
||||||
$sentry_span->finish();
|
$sentry_span->finish();
|
||||||
|
if (!$success)
|
||||||
|
Log :: fatal(I18n::_("This request could not be processed correctly."));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue