diff options
author | Louis Chemineau <louis@chmn.me> | 2022-02-16 16:56:14 +0300 |
---|---|---|
committer | Louis Chemineau <louis@chmn.me> | 2022-02-16 16:56:14 +0300 |
commit | bc2c02f451fc4e625753cb9821131231ab5cc1a9 (patch) | |
tree | cea88767f82ae7e37c9f49f2f0283bd134177de4 /apps/dav/lib/Connector/Sabre | |
parent | 0b768c17d22d49a1631ea5a1ad8c94696fca46e0 (diff) |
Wrap S3 multipart upload exception
Signed-off-by: Louis Chemineau <louis@chmn.me>
Diffstat (limited to 'apps/dav/lib/Connector/Sabre')
-rw-r--r-- | apps/dav/lib/Connector/Sabre/Exception/BadGateway.php | 40 | ||||
-rw-r--r-- | apps/dav/lib/Connector/Sabre/File.php | 3 |
2 files changed, 43 insertions, 0 deletions
diff --git a/apps/dav/lib/Connector/Sabre/Exception/BadGateway.php b/apps/dav/lib/Connector/Sabre/Exception/BadGateway.php new file mode 100644 index 00000000000..c4cd6db190a --- /dev/null +++ b/apps/dav/lib/Connector/Sabre/Exception/BadGateway.php @@ -0,0 +1,40 @@ +<?php +/** + * @copyright Copyright (c) 2021, Louis Chemineau <louis@chmn.me> + * + * @author Louis Chemineau <louis@chmn.me> + * + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + * + */ +namespace OCA\DAV\Connector\Sabre\Exception; + +/** + * Bad Gateway + * + * This exception is thrown whenever the server, while acting as a gateway or proxy, received an invalid response from the upstream server. + * + */ +class BadGateway extends \Sabre\DAV\Exception { + + /** + * Returns the HTTP status code for this exception + * + * @return int + */ + public function getHTTPCode() { + return 502; + } +} diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php index 5ff5f831eb5..28817b93b76 100644 --- a/apps/dav/lib/Connector/Sabre/File.php +++ b/apps/dav/lib/Connector/Sabre/File.php @@ -47,6 +47,7 @@ use OCA\DAV\Connector\Sabre\Exception\EntityTooLarge; use OCA\DAV\Connector\Sabre\Exception\FileLocked; use OCA\DAV\Connector\Sabre\Exception\Forbidden as DAVForbiddenException; use OCA\DAV\Connector\Sabre\Exception\UnsupportedMediaType; +use OCA\DAV\Connector\Sabre\Exception\BadGateway; use OCP\Encryption\Exceptions\GenericEncryptionException; use OCP\Files\EntityTooLargeException; use OCP\Files\FileInfo; @@ -206,6 +207,8 @@ class File extends Node implements IFile { $count = $partStorage->writeStream($internalPartPath, $wrappedData); } catch (GenericFileException $e) { $result = false; + } catch (BadGateway $e) { + throw $e; } |