我搜索了 SilverStripe 4 的文档和 API,但在使用适当的类调用默认异常处理程序时遇到问题。
在我的 Page.php 控制器的 init() 中的 SilverStripe 4 之前它是如何工作的
parent::init();
set_exception_handler(function($exception) {
if( get_class($exception) == 'CustomException' ) {
Controller::curr()->handleCustomException($exception);
}
return exceptionHandler($exception);
});
我希望它如何与 SilverStripe 4 一起使用
parent::init();
set_exception_handler(function($exception) {
if( get_class($exception) == 'CustomException' ) {
Controller::curr()->handleCustomException($exception);
}
return <SomeMonologClass>::handleException($exception);
});
我知道 SilverStripe 4 现在使用 Monolog 并且我遇到了handleException
我认为我需要调用的函数而不是exceptionHandler($exception)
.
任何建议将不胜感激。