Skip to content

Commit 4819734

Browse files
Merge pull request #62795 from nextcloud/user-create-getobject-log
fix: improve logging when failing to get newly created user
2 parents 98889bd + afcf606 commit 4819734

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
@@ -457,7 +457,16 @@ public function createUserFromBackend($uid, $password, UserInterface $backend):
457457
if ($state === false) {
458458
throw new \InvalidArgumentException($l->t('Could not create account'));
459459
}
460-
$user = $this->getUserObject($uid, $backend);
460+
try {
461+
$user = $this->getUserObject($uid, $backend);
462+
} catch (\RuntimeException $e) {
463+
$this->logger->error('Failed to get user after creation', [
464+
'exception' => $e,
465+
'uid' => $uid,
466+
'exists_backend' => $backend->userExists($uid),
467+
]);
468+
throw new \RuntimeException('Failed to get user after creation', previous: $e);
469+
}
461470
if ($user instanceof IUser) {
462471
/** @deprecated 21.0.0 use UserCreatedEvent event with the IEventDispatcher instead */
463472
$this->emit('\OC\User', 'postCreateUser', [$user, $password]);

0 commit comments

Comments
 (0)