Exception.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <?php
  2. declare(strict_types=1);
  3. namespace Yansongda\Pay\Exception;
  4. use Throwable;
  5. class Exception extends \Exception
  6. {
  7. public const UNKNOWN_ERROR = 9999;
  8. /**
  9. * 关于容器.
  10. */
  11. public const CONTAINER_ERROR = 1000;
  12. public const CONTAINER_NOT_FOUND = 1001;
  13. public const CONTAINER_NOT_FOUND_ENTRY = 1002;
  14. /**
  15. * 关于容器的服务.
  16. */
  17. public const SERVICE_ERROR = 2000;
  18. public const SERVICE_NOT_FOUND_ERROR = 2001;
  19. /*
  20. * 关于配置.
  21. */
  22. public const CONFIG_ERROR = 3000;
  23. public const INVALID_PARSER = 3001;
  24. public const ALIPAY_CONFIG_ERROR = 3002;
  25. public const LOGGER_CONFIG_ERROR = 3003;
  26. public const HTTP_CLIENT_CONFIG_ERROR = 3004;
  27. public const EVENT_CONFIG_ERROR = 3005;
  28. public const WECHAT_CONFIG_ERROR = 3006;
  29. public const UNIPAY_CONFIG_ERROR = 3007;
  30. public const INVALID_PACKER = 3008;
  31. /*
  32. * 关于参数.
  33. */
  34. public const PARAMS_ERROR = 4000;
  35. public const SHORTCUT_NOT_FOUND = 4001;
  36. public const PLUGIN_ERROR = 4002;
  37. public const SHORTCUT_MULTI_ACTION_ERROR = 4003;
  38. public const METHOD_NOT_SUPPORTED = 4004;
  39. public const REQUEST_NULL_ERROR = 4005;
  40. public const MISSING_NECESSARY_PARAMS = 4006;
  41. public const NOT_IN_SERVICE_MODE = 4007;
  42. public const WECHAT_SERIAL_NO_NOT_FOUND = 4008;
  43. public const UNIPAY_FIND_STRING_NOT_SUPPORTED = 4009;
  44. public const UNIPAY_CANCEL_STRING_NOT_SUPPORTED = 4010;
  45. /**
  46. * 关于api.
  47. */
  48. public const RESPONSE_ERROR = 5000;
  49. public const REQUEST_RESPONSE_ERROR = 5001;
  50. public const UNPACK_RESPONSE_ERROR = 5002;
  51. public const INVALID_RESPONSE_SIGN = 5003;
  52. public const INVALID_RESPONSE_CODE = 5004;
  53. public const RESPONSE_MISSING_NECESSARY_PARAMS = 5005;
  54. public const RESPONSE_NONE = 5006;
  55. public const INVALID_CIPHERTEXT_PARAMS = 5007;
  56. public const INVALID_REQUEST_ENCRYPTED_DATA = 5008;
  57. public const INVALID_REQUEST_ENCRYPTED_METHOD = 5009;
  58. /**
  59. * raw.
  60. *
  61. * @var mixed
  62. */
  63. public $extra;
  64. /**
  65. * @param mixed $extra
  66. */
  67. public function __construct(string $message = 'Unknown Error', int $code = self::UNKNOWN_ERROR, $extra = null, Throwable $previous = null)
  68. {
  69. $this->extra = $extra;
  70. parent::__construct($message, $code, $previous);
  71. }
  72. }