FileLocked.php 784 B

1234567891011121314151617181920212223242526272829303132
  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. class FileLocked extends \Sabre\DAV\Exception {
  10. /**
  11. * @param string $message
  12. * @param int $code
  13. */
  14. public function __construct($message = '', $code = 0, ?Exception $previous = null) {
  15. if ($previous instanceof \OCP\Files\LockNotAcquiredException) {
  16. $message = sprintf('Target file %s is locked by another process.', $previous->path);
  17. }
  18. parent::__construct($message, $code, $previous);
  19. }
  20. /**
  21. * Returns the HTTP status code for this exception
  22. *
  23. * @return int
  24. */
  25. public function getHTTPCode() {
  26. return 423;
  27. }
  28. }