FileLocked.php 813 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCA\DAV\Connector\Sabre\Exception;
  8. use Exception;
  9. use OCP\Files\LockNotAcquiredException;
  10. class FileLocked extends \Sabre\DAV\Exception {
  11. /**
  12. * @param string $message
  13. * @param int $code
  14. */
  15. public function __construct($message = '', $code = 0, ?Exception $previous = null) {
  16. if ($previous instanceof LockNotAcquiredException) {
  17. $message = sprintf('Target file %s is locked by another process.', $previous->path);
  18. }
  19. parent::__construct($message, $code, $previous);
  20. }
  21. /**
  22. * Returns the HTTP status code for this exception
  23. *
  24. * @return int
  25. */
  26. public function getHTTPCode() {
  27. return 423;
  28. }
  29. }