mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-21 23:55:35 +08:00
orgianze bootstrapper
This commit is contained in:
31
src/ZM/Exception/Handler.php
Normal file
31
src/ZM/Exception/Handler.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace ZM\Exception;
|
||||
|
||||
use OneBot\Driver\ExceptionHandler;
|
||||
use Throwable;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
// 我们知道此处没有调用父类的构造函数,这是设计上的缺陷
|
||||
// 将会在稍后修复
|
||||
}
|
||||
|
||||
public function handle(Throwable $e): void
|
||||
{
|
||||
if ($e instanceof ZMKnownException) {
|
||||
// 如果是已知异常,则可以输出问题说明和解决方案
|
||||
// TODO
|
||||
}
|
||||
|
||||
if (is_null($this->whoops)) {
|
||||
ob_logger()->error('Uncaught ' . get_class($e) . ': ' . $e->getMessage() . ' at ' . $e->getFile() . '(' . $e->getLine() . ')');
|
||||
ob_logger()->error($e->getTraceAsString());
|
||||
return;
|
||||
}
|
||||
|
||||
// $this->whoops->handleException($e);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user