GeneralException.php 991 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | [ 普通异常抛出 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2018-2020 rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Author: TABLE ME
  8. // +----------------------------------------------------------------------
  9. // | Date: 2020-08-25 16:21
  10. // +----------------------------------------------------------------------
  11. namespace library\exceptions;
  12. use Throwable;
  13. /**
  14. * Class AuthException
  15. * @package crmeb\exceptions
  16. */
  17. class GeneralException extends \RuntimeException
  18. {
  19. public function __construct($message = "", $code = 0, Throwable $previous = null)
  20. {
  21. if (is_array($message)) {
  22. $errInfo = $message;
  23. $message = $errInfo[1] ?? '未知错误';
  24. $code = $errInfo[0] ?? -1;
  25. }
  26. parent::__construct($message, $code, $previous);
  27. }
  28. }