提交 0a92e785 编写于 作者: lzc828's avatar lzc828

error code

上级 e307b72e
......@@ -66,7 +66,7 @@ class Connect
throw $e;
} catch (\Throwable $e) {
self::$connect_count--;
throw new DbException(json_encode(['info' => $e->getMessage(), 'sql' => $sql]), 7);
throw new DbException(json_encode(['info' => $e->getMessage(), 'sql' => $sql]), $e->getCode());
}
}
......@@ -237,7 +237,7 @@ class Connect
try {
return new \PDO($this->config['dns'], $this->config['username'], $this->config['password'], $this->config['ops']);
} catch (\PDOException $e) {
throw new DbException('connection failed ' . $e->getMessage(), 0);
throw new DbException('connection failed ' . $e->getMessage(), $e->getCode());
}
}
......
......@@ -6,7 +6,7 @@ use One\Facades\Log;
class DbException extends \Exception
{
public function __construct($message = "", $code = 0, $previous = null)
public function __construct($message = "", $code = 1, $previous = null)
{
Log::error($message, 3 + $code);
parent::__construct($message, $code, $previous);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册