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->setAttributes($param);
$this->afterSave($attributes, $param); $this->afterSave($attributes, $param);
$this->refresh(); $this->refresh();
} catch (Exception $exception) { } catch (\Throwable $exception) {
$lastId = false; $lastId = false;
$trance->rollback(); $trance->rollback();
} }
+1 -1
View File
@@ -202,7 +202,7 @@ class Command extends Component
if (Config::get('debug.enable', false, false)) { if (Config::get('debug.enable', false, false)) {
$this->debug($this->sql . '。 Run-time: ' . (microtime(true) - $time)); $this->debug($this->sql . '。 Run-time: ' . (microtime(true) - $time));
} }
} catch (\Throwable | Exception $exception) { } catch (\Throwable $exception) {
$this->addError($this->sql . '. error: ' . $exception->getMessage(), 'mysql'); $this->addError($this->sql . '. error: ' . $exception->getMessage(), 'mysql');
$result = []; $result = [];
} finally { } finally {
+1 -1
View File
@@ -56,7 +56,7 @@ class GiiModel extends GiiBase
if (file_exists($modelPath['path'] . '/' . $managerName . '.php')) { if (file_exists($modelPath['path'] . '/' . $managerName . '.php')) {
try { try {
$class = new \ReflectionClass($modelPath['namespace'] . '\\' . $managerName); $class = new \ReflectionClass($modelPath['namespace'] . '\\' . $managerName);
} catch (\Exception $e) { } catch (\Throwable $e) {
var_dump($e->getMessage()); 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_AFTER_REQUEST);
$event->offName(Event::EVENT_BEFORE_REQUEST); $event->offName(Event::EVENT_BEFORE_REQUEST);
$this->eventNotify($message, $event); $this->eventNotify($message, $event);
} catch (Exception $exception) { } catch (\Throwable $exception) {
$this->error($exception->getMessage()); $this->error($exception->getMessage());
} }
} }
@@ -125,7 +125,7 @@ abstract class Callback extends Application
$mail->Body = $message; $mail->Body = $message;
$mail->AltBody = $message; $mail->AltBody = $message;
$mail->send(); $mail->send();
} catch (Exception $e) { } catch (\Throwable $e) {
$this->addError($e->getMessage(), 'email'); $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']]); $events = $manager->getName(AWebsocket::MESSAGE, [null, null, $frame->data['route']]);
$manager->runWith($events, [$frame, $server]); $manager->runWith($events, [$frame, $server]);
} catch (\Exception $exception) { } catch (\Throwable $exception) {
$this->addError($exception->getMessage(), 'websocket'); $this->addError($exception->getMessage(), 'websocket');
$server->send($frame->fd, $exception->getMessage()); $server->send($frame->fd, $exception->getMessage());
} finally { } finally {
+1 -1
View File
@@ -214,7 +214,7 @@ class Node extends Application
$annotation->read($this, $reflect, $action, $annotations); $annotation->read($this, $reflect, $action, $annotations);
} }
return [$reflect->newInstance(), $action]; return [$reflect->newInstance(), $action];
} catch (Exception $exception) { } catch (\Throwable $exception) {
$this->_error = $exception->getMessage(); $this->_error = $exception->getMessage();
$this->error($exception->getMessage(), 'router'); $this->error($exception->getMessage(), 'router');
return null; return null;
+1 -1
View File
@@ -621,7 +621,7 @@ class Router extends Application implements RouterInterface
try { try {
$router = $this; $router = $this;
include_once "{$files}"; include_once "{$files}";
} catch (Exception $exception) { } catch (\Throwable $exception) {
$this->error($exception->getMessage()); $this->error($exception->getMessage());
} finally { } finally {
if (isset($exception)) { if (isset($exception)) {
+1 -1
View File
@@ -90,7 +90,7 @@ class BaseObject implements Configure
*/ */
public function addError($message, $model = 'app') public function addError($message, $model = 'app')
{ {
if ($message instanceof Exception) { if ($message instanceof \Throwable) {
$this->error($message->getMessage(), $message->getFile(), $message->getLine()); $this->error($message->getMessage(), $message->getFile(), $message->getLine());
} else { } else {
if (!is_string($message)) { 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 * @throws Exception
*/ */
public function exceptionHandler(Exception $exception) public function exceptionHandler(\Throwable $exception)
{ {
$this->category = 'exception'; $this->category = 'exception';
+3 -3
View File
@@ -217,7 +217,7 @@ class Logger extends Component
if (is_string($data)) { if (is_string($data)) {
return $data; return $data;
} }
if ($data instanceof Exception) { if ($data instanceof Throwable) {
$data = $this->getException($data); $data = $this->getException($data);
} else if (is_object($data)) { } else if (is_object($data)) {
$data = get_object_vars($data); $data = get_object_vars($data);
@@ -266,10 +266,10 @@ class Logger extends Component
/** /**
* @param Exception $exception * @param Throwable $exception
* @return array * @return array
*/ */
private function getException(Exception $exception) private function getException(Throwable $exception)
{ {
$_tmp = [$exception->getMessage()]; $_tmp = [$exception->getMessage()];
$_tmp[] = $exception->getFile() . ' on line ' . $exception->getLine(); $_tmp[] = $exception->getFile() . ' on line ' . $exception->getLine();
+1 -1
View File
@@ -164,7 +164,7 @@ class Redis extends Pool
return $result = false; return $result = false;
} }
return $result = true; return $result = true;
} catch (Exception $exception) { } catch (\Throwable $exception) {
return $result = false; return $result = false;
} finally { } finally {
if (!$result) { if (!$result) {