ClientException.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. /*
  3. * Licensed to the Apache Software Foundation (ASF) under one
  4. * or more contributor license agreements. See the NOTICE file
  5. * distributed with this work for additional information
  6. * regarding copyright ownership. The ASF licenses this file
  7. * to you under the Apache License, Version 2.0 (the
  8. * "License"); you may not use this file except in compliance
  9. * with the License. You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing,
  14. * software distributed under the License is distributed on an
  15. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  16. * KIND, either express or implied. See the License for the
  17. * specific language governing permissions and limitations
  18. * under the License.
  19. */
  20. class ClientException extends Exception
  21. {
  22. /**
  23. * @var string
  24. */
  25. private $errorCode;
  26. /**
  27. * @var string
  28. */
  29. private $errorMessage;
  30. /**
  31. * @var string
  32. */
  33. private $errorType;
  34. /**
  35. * ClientException constructor.
  36. *
  37. * @param $errorMessage
  38. * @param $errorCode
  39. */
  40. public function __construct($errorMessage, $errorCode)
  41. {
  42. parent::__construct($errorMessage);
  43. $this->errorMessage = $errorMessage;
  44. $this->errorCode = $errorCode;
  45. $this->setErrorType('Client');
  46. }
  47. /**
  48. * @return string
  49. */
  50. public function getErrorCode()
  51. {
  52. return $this->errorCode;
  53. }
  54. /**
  55. * @param $errorCode
  56. */
  57. public function setErrorCode($errorCode)
  58. {
  59. $this->errorCode = $errorCode;
  60. }
  61. /**
  62. * @return string
  63. */
  64. public function getErrorMessage()
  65. {
  66. return $this->errorMessage;
  67. }
  68. /**
  69. * @param $errorMessage
  70. */
  71. public function setErrorMessage($errorMessage)
  72. {
  73. $this->errorMessage = $errorMessage;
  74. }
  75. /**
  76. * @return string
  77. */
  78. public function getErrorType()
  79. {
  80. return $this->errorType;
  81. }
  82. /**
  83. * @param $errorType
  84. */
  85. public function setErrorType($errorType)
  86. {
  87. $this->errorType = $errorType;
  88. }
  89. }