ErrorException.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkPHP [ WE CAN DO IT JUST THINK ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://zjzit.cn>
  10. // +----------------------------------------------------------------------
  11. namespace think\exception;
  12. use think\Exception;
  13. /**
  14. * ThinkPHP错误异常
  15. * 主要用于封装 set_error_handler 和 register_shutdown_function 得到的错误
  16. * 除开从 think\Exception 继承的功能
  17. * 其他和PHP系统\ErrorException功能基本一样
  18. */
  19. class ErrorException extends Exception
  20. {
  21. /**
  22. * 用于保存错误级别
  23. * @var integer
  24. */
  25. protected $severity;
  26. /**
  27. * 错误异常构造函数
  28. * @access public
  29. * @param integer $severity 错误级别
  30. * @param string $message 错误详细信息
  31. * @param string $file 出错文件路径
  32. * @param integer $line 出错行号
  33. */
  34. public function __construct($severity, $message, $file, $line)
  35. {
  36. $this->severity = $severity;
  37. $this->message = $message;
  38. $this->file = $file;
  39. $this->line = $line;
  40. $this->code = 0;
  41. }
  42. /**
  43. * 获取错误级别
  44. * @access public
  45. * @return integer 错误级别
  46. */
  47. final public function getSeverity()
  48. {
  49. return $this->severity;
  50. }
  51. }