Skip to content

Commit a2d7865

Browse files
icewind1991backportbot[bot]
authored andcommitted
fix: improve logging when failing to get newly created user
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent 2eba60c commit a2d7865

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

lib/private/User/Manager.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,16 @@ public function createUserFromBackend($uid, $password, UserInterface $backend) {
446446
if ($state === false) {
447447
throw new \InvalidArgumentException($l->t('Could not create account'));
448448
}
449-
$user = $this->getUserObject($uid, $backend);
449+
try {
450+
$user = $this->getUserObject($uid, $backend);
451+
} catch (\RuntimeException $e) {
452+
$this->logger->error('Failed to get user after creation', [
453+
'exception' => $e,
454+
'uid' => $uid,
455+
'exists_backend' => $backend->userExists($uid),
456+
]);
457+
throw new \RuntimeException('Failed to get user after creation', previous: $e);
458+
}
450459
if ($user instanceof IUser) {
451460
/** @deprecated 21.0.0 use UserCreatedEvent event with the IEventDispatcher instead */
452461
$this->emit('\OC\User', 'postCreateUser', [$user, $password]);

0 commit comments

Comments
 (0)