]> source.dussan.org Git - nextcloud-server.git/commitdiff
improve errors for external share availability check 31261/head
authorRobin Appelman <robin@icewind.nl>
Fri, 18 Feb 2022 14:20:45 +0000 (15:20 +0100)
committerVincent Petry (Rebase PR Action) <PVince81@users.noreply.github.com>
Mon, 21 Feb 2022 14:21:28 +0000 (14:21 +0000)
Signed-off-by: Robin Appelman <robin@icewind.nl>
apps/files_sharing/lib/External/Storage.php

index 23e5ac3ea267c477daaff54e37b894039ee9a795..ffa5fb8716dd3e5740532f325db4aa60e70ce30e 100644 (file)
@@ -222,22 +222,20 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage {
                                // we remove the invalid storage
                                $this->manager->removeShare($this->mountPoint);
                                $this->manager->getMountManager()->removeMount($this->mountPoint);
-                               throw new StorageInvalidException();
+                               throw new StorageInvalidException("Remote share not found", 0, $e);
                        } else {
                                // Nextcloud instance is gone, likely to be a temporary server configuration error
-                               throw new StorageNotAvailableException();
+                               throw new StorageNotAvailableException("No nextcloud instance found at remote", 0, $e);
                        }
                } catch (ForbiddenException $e) {
                        // auth error, remove share for now (provide a dialog in the future)
                        $this->manager->removeShare($this->mountPoint);
                        $this->manager->getMountManager()->removeMount($this->mountPoint);
-                       throw new StorageInvalidException();
+                       throw new StorageInvalidException("Auth error when getting remote share");
                } catch (\GuzzleHttp\Exception\ConnectException $e) {
-                       throw new StorageNotAvailableException();
+                       throw new StorageNotAvailableException("Failed to connect to remote instance", 0, $e);
                } catch (\GuzzleHttp\Exception\RequestException $e) {
-                       throw new StorageNotAvailableException();
-               } catch (\Exception $e) {
-                       throw $e;
+                       throw new StorageNotAvailableException("Error while sending request to remote instance", 0, $e);
                }
        }