From ebbc3368bd154ac3bdc3013b84f1c7f508d77291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Tue, 18 Apr 2023 23:47:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BackupCommand.php | 2 +- Command.php | 3 ++- Db.php | 3 ++- Model.php | 2 +- Pagination.php | 4 ++-- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/BackupCommand.php b/BackupCommand.php index 6f007ac..ae2c415 100644 --- a/BackupCommand.php +++ b/BackupCommand.php @@ -111,7 +111,7 @@ class BackupCommand extends Command $output->write('dump data success'); } catch (\Throwable $throwable) { - $output->writeln($throwable->getMessage()); + $output->writeln(throwable($throwable)); } finally { return 1; } diff --git a/Command.php b/Command.php index 7aa1ce7..beb2302 100644 --- a/Command.php +++ b/Command.php @@ -211,7 +211,8 @@ class Command extends Component private function error(Throwable $throwable): bool { $message = $this->sql . '.' . json_encode($this->params, JSON_UNESCAPED_UNICODE); - return \Kiri::getLogger()->addError($message . $throwable->getMessage(), 'mysql'); + error($throwable, [$message]); + return addError($throwable->getMessage(), 'mysql'); } diff --git a/Db.php b/Db.php index ea60e5a..23e42c2 100644 --- a/Db.php +++ b/Db.php @@ -65,7 +65,8 @@ class Db implements ISqlBuilder try { $result = call_user_func($closure, ...$params); } catch (\Throwable $throwable) { - $result = logger()->addError($throwable->getMessage(), 'mysql'); + error($throwable); + $result = addError($throwable->getMessage(), 'mysql'); } finally { if ($result === false) { static::rollback(); diff --git a/Model.php b/Model.php index cecd9f4..e698c20 100644 --- a/Model.php +++ b/Model.php @@ -185,7 +185,7 @@ class Model extends Base\Model public static function inserts(array $data): bool { if (empty($data)) { - return error('Insert data empty.', 'mysql'); + return addError('Insert data empty.', 'mysql'); } return static::query()->insert($data); } diff --git a/Pagination.php b/Pagination.php index 9ef6043..5cf9a22 100644 --- a/Pagination.php +++ b/Pagination.php @@ -149,7 +149,7 @@ class Pagination extends Component try { call_user_func($this->_callback, $data, $param); } catch (\Throwable $exception) { - \Kiri::getLogger()->addError($exception, 'throwable'); + error($exception); } finally { $data = null; } @@ -179,7 +179,7 @@ class Pagination extends Component try { call_user_func($this->_callback, $data, $param); } catch (\Throwable $exception) { - \Kiri::getLogger()->addError($exception, 'throwable'); + error($exception); } }