From: Chad Horohoe Date: Fri, 15 Jul 2011 16:59:38 +0000 (+0000) Subject: Slightly more informative error message when passed a bogus key (rather than property... X-Git-Tag: 1.31.0-rc.0~28822 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=9d22f7297c977b93f3346e649d9a520fba4109d4;p=lhc%2Fweb%2Fwiklou.git Slightly more informative error message when passed a bogus key (rather than property of non-object) --- diff --git a/includes/upload/UploadStash.php b/includes/upload/UploadStash.php index 75e0b2bbea..6b6dfff5f9 100644 --- a/includes/upload/UploadStash.php +++ b/includes/upload/UploadStash.php @@ -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 {};