ValidateException.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: yunwuxin <448901948@qq.com>
  10. // +----------------------------------------------------------------------
  11. namespace think\exception;
  12. class ValidateException extends \RuntimeException
  13. {
  14. protected $error;
  15. public function __construct($error, $code = 0)
  16. {
  17. $this->error = $error;
  18. $this->message = is_array($error) ? implode(PHP_EOL, $error) : $error;
  19. $this->code = $code;
  20. }
  21. /**
  22. * 获取验证错误信息
  23. * @access public
  24. * @return array|string
  25. */
  26. public function getError()
  27. {
  28. return $this->error;
  29. }
  30. }