mirror of
https://github.com/nextcloud/server.git
synced 2026-07-12 19:16:25 -04:00
And use this new exception everywhere outside of where the old one was throw. Signed-off-by: Carl Schwan <carlschwan@kde.org>
31 lines
776 B
PHP
31 lines
776 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
namespace OCP\User\Exceptions;
|
|
|
|
use OCP\AppFramework\Attribute\Catchable;
|
|
use OCP\AppFramework\Attribute\Throwable;
|
|
|
|
/**
|
|
* The class UserNotFoundException is thrown when no user is found.
|
|
*
|
|
* @since 35.0.0
|
|
*/
|
|
#[Throwable(since: '35.0.0')]
|
|
#[Catchable(since: '35.0.0')]
|
|
class UserNotFoundException extends \Exception {
|
|
/**
|
|
* Return a UserNotFoundException with a standard error message.
|
|
*
|
|
* @since 35.0.0
|
|
*/
|
|
public static function createForUser(string $userId, ?\Exception $previous = null): self {
|
|
return new UserNotFoundException('User with ' . $userId . ' not found.', previous: $previous);
|
|
}
|
|
}
|