Skip to content

Commit

Permalink
Add additional errors
Browse files Browse the repository at this point in the history
  • Loading branch information
vanbukin committed Dec 28, 2023
1 parent d29a390 commit baa311f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ public async Task<IActionResult> CompleteAuthentication(
cancellationToken);
if (authenticationCeremonyId is null)
{
return BadRequest();
ModelState.AddModelError("", "Authentication ceremony not found");
return BadRequest(ModelState);
}

var result = await _authenticationCeremonyService.CompleteCeremonyAsync(
Expand All @@ -106,7 +107,8 @@ public async Task<IActionResult> CompleteAuthentication(
cancellationToken);
if (result.HasError)
{
return BadRequest();
ModelState.AddModelError("", "The authentication ceremony completed with an error");
return BadRequest(ModelState);
}

var applicationUser = await _userService.FindAsync(
Expand All @@ -115,7 +117,8 @@ public async Task<IActionResult> CompleteAuthentication(
cancellationToken);
if (applicationUser is null)
{
return BadRequest();
ModelState.AddModelError("", "User not found");
return BadRequest(ModelState);
}

var claims = new List<Claim>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ public async Task<IActionResult> CompleteRegistration(
cancellationToken);
if (registrationCeremonyId is null)
{
return BadRequest();
ModelState.AddModelError("", "Registration ceremony not found");
return BadRequest(ModelState);
}

var result = await _registrationCeremonyService.CompleteCeremonyAsync(
Expand All @@ -88,7 +89,8 @@ public async Task<IActionResult> CompleteRegistration(
cancellationToken);
if (result.HasError)
{
return BadRequest();
ModelState.AddModelError("", "The registration ceremony completed with an error");
return BadRequest(ModelState);
}

await _registrationCeremonyHandleService.DeleteAsync(HttpContext, cancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ public async Task<IActionResult> CompleteAuthentication(
cancellationToken);
if (authenticationCeremonyId is null)
{
return BadRequest();
ModelState.AddModelError("", "Authentication ceremony not found");
return BadRequest(ModelState);
}

var result = await _authenticationCeremonyService.CompleteCeremonyAsync(
Expand All @@ -95,7 +96,8 @@ public async Task<IActionResult> CompleteAuthentication(
cancellationToken);
if (result.HasError)
{
return BadRequest();
ModelState.AddModelError("", "The authentication ceremony completed with an error");
return BadRequest(ModelState);
}

var applicationUser = await _userService.FindAsync(
Expand All @@ -104,7 +106,8 @@ public async Task<IActionResult> CompleteAuthentication(
cancellationToken);
if (applicationUser is null)
{
return BadRequest();
ModelState.AddModelError("", "User not found");
return BadRequest(ModelState);
}

var claims = new List<Claim>
Expand Down

0 comments on commit baa311f

Please sign in to comment.