Slightly more informative error message when passed a bogus key (rather than property...
authorChad Horohoe <demon@users.mediawiki.org>
Fri, 15 Jul 2011 16:59:38 +0000 (16:59 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Fri, 15 Jul 2011 16:59:38 +0000 (16:59 +0000)
includes/upload/UploadStash.php

index 75e0b2b..6b6dfff 100644 (file)
@@ -353,6 +353,10 @@ class UploadStash {
                        __METHOD__
                );
 
+               if( !$row ) {
+                       throw new UploadStashNoSuchKeyException( "No such key ($key), cannot remove" );
+               }
+
                if ( $row->us_user != $this->userId ) {
                        throw new UploadStashWrongOwnerException( "Can't delete: the file ($key) doesn't belong to this user." );
                }
@@ -690,3 +694,4 @@ class UploadStashZeroLengthFileException extends MWException {};
 class UploadStashNotLoggedInException extends MWException {};
 class UploadStashWrongOwnerException extends MWException {};
 class UploadStashMaxLagExceededException extends MWException {};
+class UploadStashNoSuchKeyException extends MWException {};