mirror of
https://github.com/fastapi-users/fastapi-users.git
synced 2025-11-01 18:48:14 +08:00
Create a user programmatically documentation - change example to return things. (#1356)
* Changed method to return user or raise an exception * Re-raise UserAlreadyExists exception instead of creating a new one.
This commit is contained in:
@ -21,5 +21,7 @@ async def create_user(email: str, password: str, is_superuser: bool = False):
|
||||
)
|
||||
)
|
||||
print(f"User created {user}")
|
||||
return user
|
||||
except UserAlreadyExists:
|
||||
print(f"User {email} already exists")
|
||||
raise
|
||||
|
||||
Reference in New Issue
Block a user