From: daniel Date: Wed, 18 Dec 2019 11:50:37 +0000 (+0100) Subject: User: better error message when getActorId fails. X-Git-Tag: 1.34.1~22 X-Git-Url: http://git.cyclocoop.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=62b44d8c3ad4838e2045d514dd603625ce53d9df User: better error message when getActorId fails. This changes User::getActorId() to include the user name and id when throwing an exception. This doesn't solve the problem reported in T211450, but should allow the the probelmatic user name to be identified. Bug: T211450 Change-Id: Ie83ce6ad6b5ef18ea44a52e204f580cd9c992148 (cherry picked from commit db3e7f8b7e81eed410e6f82f939038768efd27ce) --- diff --git a/includes/user/User.php b/includes/user/User.php index 2679e87c64..a677edec2a 100644 --- a/includes/user/User.php +++ b/includes/user/User.php @@ -2280,11 +2280,15 @@ class User implements IDBAccessObject, UserIdentity { ]; if ( $q['actor_user'] === null && self::isUsableName( $q['actor_name'] ) ) { throw new CannotCreateActorException( - 'Cannot create an actor for a usable name that is not an existing user' + 'Cannot create an actor for a usable name that is not an existing user: ' . + "user_id={$this->getId()} user_name=\"{$this->getName()}\"" ); } if ( $q['actor_name'] === '' ) { - throw new CannotCreateActorException( 'Cannot create an actor for a user with no name' ); + throw new CannotCreateActorException( + 'Cannot create an actor for a user with no name: ' . + "user_id={$this->getId()} user_name=\"{$this->getName()}\"" + ); } $dbw->insert( 'actor', $q, __METHOD__, [ 'IGNORE' ] ); if ( $dbw->affectedRows() ) { @@ -2301,7 +2305,8 @@ class User implements IDBAccessObject, UserIdentity { ); if ( !$this->mActorId ) { throw new CannotCreateActorException( - "Cannot create actor ID for user_id={$this->getId()} user_name={$this->getName()}" + "Failed to create actor ID for " . + "user_id={$this->getId()} user_name=\"{$this->getName()}\"" ); } }