forward invalid argument message to frontend when creating a user fails

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2021-02-11 17:05:51 +01:00
parent 5babad4f6f
commit c6ce1eb557
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
1 changed files with 7 additions and 0 deletions

View File

@ -441,6 +441,13 @@ class UsersController extends AUserData {
'app' => 'ocs_api',
]);
throw $e;
} catch (\InvalidArgumentException $e) {
$this->logger->logException($e, [
'message' => 'Failed addUser attempt with invalid argument exeption.',
'level' => ILogger::ERROR,
'app' => 'ocs_api',
]);
throw new OCSException($e->getMessage(), 101);
} catch (\Exception $e) {
$this->logger->logException($e, [
'message' => 'Failed addUser attempt with exception.',