]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add message to NotSquareException thrown from Avatar
authorOlivier Mehani <shtrom@ssji.net>
Thu, 29 Sep 2016 11:51:07 +0000 (21:51 +1000)
committerMorris Jobke <hey@morrisjobke.de>
Mon, 24 Oct 2016 09:27:27 +0000 (11:27 +0200)
This prevents cryptic messages such as the following, from `user_ldap`:

     Could not set avatar for uid=user,ou=People,dc=example,dc=net, because:

Signed-off-by: Olivier Mehani <shtrom@ssji.net>
Add message to NotPermittedException thrown from Files\Nodes\Folder

Ditto.

Don't use translation macros here as this seems to be pretty low-level
errors that generally get caught and prettified, and I don't want to
unduly clog down the lower layers.

Signed-off-by: Olivier Mehani <shtrom@ssji.net>
fixup! Add message to NotPermittedException thrown from Files\Nodes\Folder

lib/private/Avatar.php
lib/private/Files/Node/Folder.php

index c3a068701df1ecaf1d26d327827dc15317fa842a..fc1909c3bdafff0d6dff57f6435aa650d8b55c25 100644 (file)
@@ -131,7 +131,7 @@ class Avatar implements IAvatar {
                }
 
                if (!($img->height() === $img->width())) {
-                       throw new NotSquareException();
+                       throw new NotSquareException($this->l->t("Avatar image is not square"));
                }
 
                $this->remove();
index 353b89068cbadfad0bb3e6e161a49c813ed52cfe..a6165fa9636fdb2dc862a5c5580d393fed5bc0fe 100644 (file)
@@ -42,7 +42,7 @@ class Folder extends Node implements \OCP\Files\Folder {
         */
        public function getFullPath($path) {
                if (!$this->isValidPath($path)) {
-                       throw new NotPermittedException();
+                       throw new NotPermittedException('Invalid path: ' . $path);
                }
                return $this->path . $this->normalizePath($path);
        }
@@ -152,7 +152,7 @@ class Folder extends Node implements \OCP\Files\Folder {
                        $this->root->emit('\OC\Files', 'postCreate', array($node));
                        return $node;
                } else {
-                       throw new NotPermittedException();
+                       throw new NotPermittedException('No create permission for folder ' . $this->getFullPath($path));
                }
        }
 
@@ -173,7 +173,7 @@ class Folder extends Node implements \OCP\Files\Folder {
                        $this->root->emit('\OC\Files', 'postCreate', array($node));
                        return $node;
                } else {
-                       throw new NotPermittedException();
+                       throw new NotPermittedException('No create permission for path ' . $this->getFullPath($path));
                }
        }
 
@@ -321,7 +321,7 @@ class Folder extends Node implements \OCP\Files\Folder {
                        $this->root->emit('\OC\Files', 'postDelete', array($nonExisting));
                        $this->exists = false;
                } else {
-                       throw new NotPermittedException();
+                       throw new NotPermittedException('No delete permission for path ' . $this->getFullPath($this->path));
                }
        }
 
@@ -343,7 +343,7 @@ class Folder extends Node implements \OCP\Files\Folder {
                        $this->root->emit('\OC\Files', 'postWrite', array($targetNode));
                        return $targetNode;
                } else {
-                       throw new NotPermittedException();
+                       throw new NotPermittedException('No permission to copy to path ' . $targetPath);
                }
        }
 
@@ -366,7 +366,7 @@ class Folder extends Node implements \OCP\Files\Folder {
                        $this->path = $targetPath;
                        return $targetNode;
                } else {
-                       throw new NotPermittedException();
+                       throw new NotPermittedException('No permission to move to path ' . $targetPath);
                }
        }