alreadyfulfilledexception.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * GNU social - a federating social network
  4. * Copyright (C) 2014, Free Software Foundation, Inc.
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU Affero General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU Affero General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Affero General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. if (!defined('GNUSOCIAL')) { exit(1); }
  20. /**
  21. * Parent class for an exception when trying to do something that was
  22. * probably already done.
  23. *
  24. * This is a common case for example when remote sites are not up to
  25. * date with our database. For example subscriptions, where a remote
  26. * user may be unsubscribed from our user, but they request it anyway.
  27. *
  28. * This exception is usually caught in a manner that lets the execution
  29. * continue _as if_ the desired action did what it was supposed to do.
  30. *
  31. * @category Exception
  32. * @package GNUsocial
  33. * @author Mikael Nordfeldth <mmn@hethane.se>
  34. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
  35. * @link http://gnu.io/
  36. */
  37. class AlreadyFulfilledException extends ServerException
  38. {
  39. public function __construct($msg=null)
  40. {
  41. if ($msg === null) {
  42. // TRANS: Exception text when attempting to perform something which seems already done.
  43. $msg = _('Trying to do something that was already done.');
  44. }
  45. parent::__construct($msg, 409);
  46. }
  47. }