Skip to content

Commit fa17fff

Browse files
ShouldThrowServiceExceptionOnModifyIfDatabaseUpdateErrorOccursAndLogItAsync -> PASS
1 parent be7facb commit fa17fff

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

LibraryManagement.Api.Tests.Unit/Services/Foundations/Readers/ReaderServiceTests.Exceptions.Modify.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public async Task ShouldThrowServiceExceptionOnModifyIfDatabaseUpdateErrorOccurs
165165
Reader randomReader = CreateRandomReader();
166166
Reader someReader = randomReader;
167167
Guid readerId = someReader.ReaderId;
168-
Exception serviceException = new Exception();
168+
var serviceException = new Exception();
169169

170170
var failedReaderServiceException =
171171
new FailedReaderServiceException(serviceException);

LibraryManagement.Api/Services/Foundations/Readers/ReaderService.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,18 @@ public async ValueTask<Reader> ModifyReaderAsync(Reader reader)
125125

126126
throw readerDependencyException;
127127
}
128+
catch (Exception exception)
129+
{
130+
var failedReaderServiceException =
131+
new FailedReaderServiceException(exception);
132+
133+
var readerServiceException =
134+
new ReaderServiceException(failedReaderServiceException);
135+
136+
this.loggingBroker.LogError(readerServiceException);
137+
138+
throw readerServiceException;
139+
}
128140
}
129141
}
130142
}

0 commit comments

Comments
 (0)