Skip to content

Commit

Permalink
implemented suggested changes to avoid duplicate error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mariaruth1 committed May 23, 2024
1 parent d4ba13c commit b7206f8
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions api/Events/Collections/Client/ClientWantsToDeleteCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,9 @@ public class ClientWantsToDeleteCollection(CollectionsService collectionsService
{
public override async Task Handle(ClientWantsToDeleteCollectionDto dto, IWebSocketConnection socket)
{
try
{
var email = jwtService.GetEmailFromJwt(dto.Jwt!);
await collectionsService.DeleteCollection(dto.CollectionId, email);
socket.SendDto(new ServerDeletesCollection());
}
catch (Exception e) when (e is not NotFoundException)
{
socket.SendDto(new ServerRejectsUpdate
{
Error = "Could not delete collection. Please try again later."
});
}
var email = jwtService.GetEmailFromJwt(dto.Jwt!);
await collectionsService.DeleteCollection(dto.CollectionId, email);
socket.SendDto(new ServerDeletesCollection());

}
}

0 comments on commit b7206f8

Please sign in to comment.