clientexception.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. // This file is part of GNU social - https://www.gnu.org/software/social
  3. //
  4. // GNU social is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU Affero General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // GNU social is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU Affero General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU Affero General Public License
  15. // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
  16. /**
  17. * Class for a client exception (user error)
  18. *
  19. * @category Exception
  20. * @package GNUsocial
  21. * @author Evan Prodromou <evan@status.net>
  22. * @copyright 2008 StatusNet, Inc.
  23. * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
  24. */
  25. defined('GNUSOCIAL') || die();
  26. /**
  27. * Class for client exceptions
  28. *
  29. * Subclass of PHP Exception for user errors.
  30. *
  31. * @category Exception
  32. * @package GNUsocial
  33. * @author Evan Prodromou <evan@status.net>
  34. * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
  35. */
  36. class ClientException extends Exception
  37. {
  38. public function __construct(
  39. string $message = '',
  40. int $code = 500,
  41. Throwable $previous = null
  42. ) {
  43. parent::__construct($message, $code, $previous);
  44. }
  45. // custom string representation of object
  46. public function __toString()
  47. {
  48. return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
  49. }
  50. }