FileLocked.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  6. * @author Lukas Reschke <lukas@statuscode.ch>
  7. * @author Morris Jobke <hey@morrisjobke.de>
  8. * @author Owen Winkler <a_github@midnightcircus.com>
  9. * @author Thomas Müller <thomas.mueller@tmit.eu>
  10. * @author Vincent Petry <vincent@nextcloud.com>
  11. *
  12. * @license AGPL-3.0
  13. *
  14. * This code is free software: you can redistribute it and/or modify
  15. * it under the terms of the GNU Affero General Public License, version 3,
  16. * as published by the Free Software Foundation.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU Affero General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU Affero General Public License, version 3,
  24. * along with this program. If not, see <http://www.gnu.org/licenses/>
  25. *
  26. */
  27. namespace OCA\DAV\Connector\Sabre\Exception;
  28. use Exception;
  29. class FileLocked extends \Sabre\DAV\Exception {
  30. public function __construct($message = "", $code = 0, Exception $previous = null) {
  31. if ($previous instanceof \OCP\Files\LockNotAcquiredException) {
  32. $message = sprintf('Target file %s is locked by another process.', $previous->path);
  33. }
  34. parent::__construct($message, $code, $previous);
  35. }
  36. /**
  37. * Returns the HTTP status code for this exception
  38. *
  39. * @return int
  40. */
  41. public function getHTTPCode() {
  42. return 423;
  43. }
  44. }