diff --git a/Command.php b/Command.php index cbb8e52..41234fe 100644 --- a/Command.php +++ b/Command.php @@ -123,6 +123,8 @@ class Command extends Component return $result; } catch (Throwable $throwable) { + $this->getLogger()->failure(throwable($throwable), 'mysql'); + if ($this->isRefresh($throwable)) return $this->search($method); $errorMsg = $throwable->getMessage() . PHP_EOL . ' Sql: ' . $this->sql . '.' . json_encode($this->params); @@ -167,6 +169,8 @@ class Command extends Component return $result == 0 ? $prepare->rowCount() : (int)$result; } catch (Throwable $throwable) { + $this->getLogger()->failure(throwable($throwable), 'mysql'); + if ($this->isRefresh($throwable)) return $this->_prepare(); $errorMsg = $throwable->getMessage() . PHP_EOL . ' Sql: ' . $this->sql . '.' . json_encode($this->params);