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
@@ -374,7 +374,7 @@ abstract class BaseActiveRecord extends Component implements IOrm, \ArrayAccess
$this->setAttributes($param);
$this->afterSave($attributes, $param);
$this->refresh();
} catch (Exception $exception) {
} catch (\Throwable $exception) {
$lastId = false;
$trance->rollback();
}
+1 -1
View File
@@ -202,7 +202,7 @@ class Command extends Component
if (Config::get('debug.enable', false, false)) {
$this->debug($this->sql . '。 Run-time: ' . (microtime(true) - $time));
}
} catch (\Throwable | Exception $exception) {
} catch (\Throwable $exception) {
$this->addError($this->sql . '. error: ' . $exception->getMessage(), 'mysql');
$result = [];
} finally {
+1 -1
View File
@@ -56,7 +56,7 @@ class GiiModel extends GiiBase
if (file_exists($modelPath['path'] . '/' . $managerName . '.php')) {
try {
$class = new \ReflectionClass($modelPath['namespace'] . '\\' . $managerName);
} catch (\Exception $e) {
} catch (\Throwable $e) {
var_dump($e->getMessage());
}
}
+2 -2
View File
@@ -41,7 +41,7 @@ abstract class Callback extends Application
$event->offName(Event::EVENT_AFTER_REQUEST);
$event->offName(Event::EVENT_BEFORE_REQUEST);
$this->eventNotify($message, $event);
} catch (Exception $exception) {
} catch (\Throwable $exception) {
$this->error($exception->getMessage());
}
}
@@ -125,7 +125,7 @@ abstract class Callback extends Application
$mail->Body = $message;
$mail->AltBody = $message;
$mail->send();
} catch (Exception $e) {
} catch (\Throwable $e) {
$this->addError($e->getMessage(), 'email');
}
}
+1 -1
View File
@@ -43,7 +43,7 @@ class OnMessage extends Callback
}
$events = $manager->getName(AWebsocket::MESSAGE, [null, null, $frame->data['route']]);
$manager->runWith($events, [$frame, $server]);
} catch (\Exception $exception) {
} catch (\Throwable $exception) {
$this->addError($exception->getMessage(), 'websocket');
$server->send($frame->fd, $exception->getMessage());
} finally {
+1 -1
View File
@@ -214,7 +214,7 @@ class Node extends Application
$annotation->read($this, $reflect, $action, $annotations);
}
return [$reflect->newInstance(), $action];
} catch (Exception $exception) {
} catch (\Throwable $exception) {
$this->_error = $exception->getMessage();
$this->error($exception->getMessage(), 'router');
return null;
+1 -1
View File
@@ -621,7 +621,7 @@ class Router extends Application implements RouterInterface
try {
$router = $this;
include_once "{$files}";
} catch (Exception $exception) {
} catch (\Throwable $exception) {
$this->error($exception->getMessage());
} finally {
if (isset($exception)) {
+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) {