first commit

This commit is contained in:
yanwenwu
2019-12-22 09:37:52 +08:00
parent cf1dedabd4
commit b27ef2570a
359 changed files with 34726 additions and 758 deletions

View File

@@ -1,5 +1,20 @@
<?php
namespace catcher\exceptions;
abstract class CatchException extends \Exception
{}
use Exception;
use think\exception\HttpException;
abstract class CatchException extends HttpException
{
protected const HTTP_SUCCESS = 200;
public function __construct(string $message = '', int $code = 0, Exception $previous = null, array $headers = [], $statusCode = 0)
{
parent::__construct($statusCode, $message, $previous, $headers, $code);
}
public function getStatusCode()
{
return self::HTTP_SUCCESS;
}
}

View File

@@ -1,7 +1,9 @@
<?php
namespace catcher\exceptions;
use catcher\Code;
class FailedException extends CatchException
{
protected $code = 10010;
protected $code = Code::FAILED;
}

View File

@@ -1,7 +1,9 @@
<?php
namespace catcher\exceptions;
use catcher\Code;
class LoginFailedException extends CatchException
{
protected $code = 10010;
protected $code = Code::LOGIN_FAILED;
}

View File

@@ -1,9 +1,11 @@
<?php
namespace catcher\exceptions;
use catcher\Code;
class PermissionForbiddenException extends CatchException
{
protected $code = 10005;
protected $code = Code::PERMISSION_FORBIDDEN;
protected $message = 'permission forbidden';
}

View File

@@ -1,7 +1,9 @@
<?php
namespace catcher\exceptions;
use catcher\Code;
class ValidateFailedException extends CatchException
{
protected $code = 10001;
protected $code = Code::VALIDATE_FAILED;
}