内核更新

This commit is contained in:
2016-08-23 18:01:41 +08:00
parent 707ebdf51d
commit 94582d442c
22 changed files with 249 additions and 286 deletions

View File

@@ -13,20 +13,20 @@ namespace think\exception;
class ClassNotFoundException extends \RuntimeException
{
protected $class;
public function __construct($message,$class='')
{
$this->message = $message;
$this->class = $class;
}
protected $class;
public function __construct($message, $class = '')
{
$this->message = $message;
$this->class = $class;
}
/**
* 获取类名
* @access public
* @return string
*/
public function getClass()
{
return $this->class;
}
}
public function getClass()
{
return $this->class;
}
}

View File

@@ -16,28 +16,27 @@ use think\Exception;
/**
* Database相关异常处理类
*/
class DbException extends Exception
class DbException extends Exception
{
/**
* DbException constructor.
* @param string $message
* @param array $config
* @param string $sql
* @param int $code
* @param string $message
* @param array $config
* @param string $sql
* @param int $code
*/
public function __construct($message, Array $config, $sql, $code = 10500)
public function __construct($message, array $config, $sql, $code = 10500)
{
$this->message = $message;
$this->code = $code;
$this->message = $message;
$this->code = $code;
$this->setData('Database Status', [
'Error Code' => $code,
'Error Message' => $message,
'Error SQL' => $sql
'Error SQL' => $sql,
]);
$this->setData('Database Config', $config);
}
}

View File

@@ -11,7 +11,6 @@
namespace think\exception;
class HttpException extends \RuntimeException
{
private $statusCode;
@@ -34,4 +33,4 @@ class HttpException extends \RuntimeException
{
return $this->headers;
}
}
}

View File

@@ -11,7 +11,6 @@
namespace think\exception;
use think\Response;
class HttpResponseException extends \RuntimeException
@@ -31,5 +30,4 @@ class HttpResponseException extends \RuntimeException
return $this->response;
}
}
}

View File

@@ -17,23 +17,23 @@ use think\exception\DbException;
* PDO异常处理类
* 重新封装了系统的\PDOException类
*/
class PDOException extends DbException
class PDOException extends DbException
{
/**
* PDOException constructor.
* @param \PDOException $exception
* @param array $config
* @param string $sql
* @param int $code
* @param array $config
* @param string $sql
* @param int $code
*/
public function __construct(\PDOException $exception, Array $config, $sql, $code = 10501)
public function __construct(\PDOException $exception, array $config, $sql, $code = 10501)
{
$error = $exception->errorInfo;
$this->setData('PDO Error Info', [
'SQLSTATE' => $error[0],
'Driver Error Code' => $error[1],
'Driver Error Message' => isset($error[2]) ? $error[2] : ''
'Driver Error Message' => isset($error[2]) ? $error[2] : '',
]);
parent::__construct($exception->getMessage(), $config, $sql, $code);

View File

@@ -13,21 +13,21 @@ namespace think\exception;
class TemplateNotFoundException extends \RuntimeException
{
protected $template;
protected $template;
public function __construct($message,$template='')
{
$this->message = $message;
$this->template = $template;
}
public function __construct($message, $template = '')
{
$this->message = $message;
$this->template = $template;
}
/**
* 获取模板文件
* @access public
* @return string
*/
public function getTemplate()
{
return $this->template;
}
}
public function getTemplate()
{
return $this->template;
}
}

View File

@@ -11,7 +11,6 @@
namespace think\exception;
class ThrowableError extends \ErrorException
{
public function __construct(\Throwable $e)
@@ -36,7 +35,6 @@ class ThrowableError extends \ErrorException
$e->getLine()
);
$this->setTrace($e->getTrace());
}
@@ -46,4 +44,4 @@ class ThrowableError extends \ErrorException
$traceReflector->setAccessible(true);
$traceReflector->setValue($this, $trace);
}
}
}

View File

@@ -13,20 +13,21 @@ namespace think\exception;
class ValidateException extends \RuntimeException
{
protected $error;
protected $error;
public function __construct($error)
{
$this->error = $error;
}
public function __construct($error)
{
$this->error = $error;
$this->message = is_array($error) ? implode("\n\r", $error) : $error;
}
/**
* 获取验证错误信息
* @access public
* @return array|string
*/
public function getError()
{
return $this->error;
}
}
public function getError()
{
return $this->error;
}
}