You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.9 KiB

3 years ago
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  6. * @author Morris Jobke <hey@morrisjobke.de>
  7. * @author Owen Winkler <a_github@midnightcircus.com>
  8. * @author Robin Appelman <robin@icewind.nl>
  9. * @author Roeland Jago Douma <roeland@famdouma.nl>
  10. *
  11. * @license AGPL-3.0
  12. *
  13. * This code is free software: you can redistribute it and/or modify
  14. * it under the terms of the GNU Affero General Public License, version 3,
  15. * as published by the Free Software Foundation.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License, version 3,
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>
  24. *
  25. */
  26. /**
  27. * Public interface of ownCloud for apps to use.
  28. * Files/LockNotAcquiredException class
  29. */
  30. // use OCP namespace for all classes that are considered public.
  31. // This means that they should be used by apps instead of the internal ownCloud classes
  32. namespace OCP\Files;
  33. /**
  34. * Exception for a file that is locked
  35. * @since 7.0.0
  36. */
  37. class LockNotAcquiredException extends \Exception {
  38. /** @var string $path The path that could not be locked */
  39. public $path;
  40. /** @var integer $lockType The type of the lock that was attempted */
  41. public $lockType;
  42. /**
  43. * @since 7.0.0
  44. */
  45. public function __construct($path, $lockType, $code = 0, \Exception $previous = null) {
  46. $message = \OC::$server->getL10N('core')->t('Could not obtain lock type %d on "%s".', [$lockType, $path]);
  47. parent::__construct($message, $code, $previous);
  48. }
  49. /**
  50. * custom string representation of object
  51. *
  52. * @return string
  53. * @since 7.0.0
  54. */
  55. public function __toString() {
  56. return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
  57. }
  58. }