UtilException.php 601 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace crmeb\exceptions;
  3. use Throwable;
  4. class UtilException extends \RuntimeException
  5. {
  6. /**
  7. * UtilException constructor.
  8. * @param string $message
  9. * @param int $code
  10. * @param Throwable|null $previous
  11. */
  12. public function __construct($message = "", $code = 0, Throwable $previous = null)
  13. {
  14. if (is_array($message)) {
  15. $errInfo = $message;
  16. $message = $errInfo[1] ?? '未知错误';
  17. $code = $errInfo[0] ?? 400;
  18. }
  19. parent::__construct($message, $code, $previous);
  20. }
  21. }