aboutsummaryrefslogtreecommitdiffstats
path: root/includes/api/ApiBase.php
diff options
context:
space:
mode:
authorthiemowmde <thiemo.kreuz@wikimedia.de>2024-01-20 21:07:28 +0100
committerthiemowmde <thiemo.kreuz@wikimedia.de>2024-01-20 21:10:12 +0100
commit0ea7599e3ef16d148f22bda633162835602c3f7c (patch)
tree520a931dfb5274c7225d01f4d6f7c5ce17a08a08 /includes/api/ApiBase.php
parent5dca00526add34d5c566e882e6763baed9d80a38 (diff)
downloadmediawikicore-0ea7599e3ef16d148f22bda633162835602c3f7c.tar.gz
mediawikicore-0ea7599e3ef16d148f22bda633162835602c3f7c.zip
Replace unspecific exceptions with InvalidArgumentException
A LogicException is very generic and doesn't mean much. An InvalidArgumentException is also a LogicException, but more specific: A method was called (for whatever reason – bad code, bad user input – we don't know) with an invalid, unsupported argument. This is exactly what's going on in these cases. BadMethodCallException does have a confusing name and is often misused because of this. It's documented as "thrown if a callback refers to an undefined method or if some arguments are missing". That's something else and not what's going on in these cases. Change-Id: Id446227f578ba701e22acd5e530ffb795e76c147
Diffstat (limited to 'includes/api/ApiBase.php')
-rw-r--r--includes/api/ApiBase.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php
index f52fbf2f60d3..607661ffa843 100644
--- a/includes/api/ApiBase.php
+++ b/includes/api/ApiBase.php
@@ -1583,7 +1583,7 @@ abstract class ApiBase extends ContextSource {
*/
public function dieStatus( StatusValue $status ) {
if ( $status->isGood() ) {
- throw new LogicException( 'Successful status passed to ApiBase::dieStatus' );
+ throw new InvalidArgumentException( 'Successful status passed to ApiBase::dieStatus' );
}
foreach ( self::MESSAGE_CODE_MAP as $msg => [ $apiMsg, $code ] ) {