Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced Await Functionality and Error Management in UsersSeed Class #361

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Identity.API/UsersSeed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ public async Task SeedAsync(ApplicationDbContext context)
SecurityNumber = "123"
};

var result = userManager.CreateAsync(alice, "Pass123$").Result;
var result = await userManager.CreateAsync(alice, "Pass123$");

if (!result.Succeeded)
{
throw new Exception(result.Errors.First().Description);
throw new Exception(string.Join(",", result.Errors.Select(error => error.Description)));
}

if (logger.IsEnabled(LogLevel.Debug))
Expand Down Expand Up @@ -79,7 +79,7 @@ public async Task SeedAsync(ApplicationDbContext context)

if (!result.Succeeded)
{
throw new Exception(result.Errors.First().Description);
throw new Exception(string.Join(",", result.Errors.Select(error => error.Description)));
}

if (logger.IsEnabled(LogLevel.Debug))
Expand Down
Loading