This commit is contained in:
2020-11-06 16:47:17 +08:00
parent 0171e39c70
commit fa4b733ea3
11 changed files with 15 additions and 15 deletions
+1 -1
View File
@@ -90,7 +90,7 @@ class BaseObject implements Configure
*/
public function addError($message, $model = 'app')
{
if ($message instanceof Exception) {
if ($message instanceof \Throwable) {
$this->error($message->getMessage(), $message->getFile(), $message->getLine());
} else {
if (!is_string($message)) {
+2 -2
View File
@@ -66,11 +66,11 @@ class ErrorHandler extends Component implements ErrorInterface
/**
* @param Exception $exception
* @param \Throwable $exception
*
* @throws Exception
*/
public function exceptionHandler(Exception $exception)
public function exceptionHandler(\Throwable $exception)
{
$this->category = 'exception';
+3 -3
View File
@@ -217,7 +217,7 @@ class Logger extends Component
if (is_string($data)) {
return $data;
}
if ($data instanceof Exception) {
if ($data instanceof Throwable) {
$data = $this->getException($data);
} else if (is_object($data)) {
$data = get_object_vars($data);
@@ -266,10 +266,10 @@ class Logger extends Component
/**
* @param Exception $exception
* @param Throwable $exception
* @return array
*/
private function getException(Exception $exception)
private function getException(Throwable $exception)
{
$_tmp = [$exception->getMessage()];
$_tmp[] = $exception->getFile() . ' on line ' . $exception->getLine();
+1 -1
View File
@@ -164,7 +164,7 @@ class Redis extends Pool
return $result = false;
}
return $result = true;
} catch (Exception $exception) {
} catch (\Throwable $exception) {
return $result = false;
} finally {
if (!$result) {