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:
Mark Donnelly
2024-02-20 00:42:23 -07:00
committed by GitHub
parent 3e38e1154c
commit d6e337a2e5
2 changed files with 3 additions and 1 deletions

View File

@ -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