Skip to content

Commit

Permalink
fix: return failed future instead of throwing exception
Browse files Browse the repository at this point in the history
  • Loading branch information
olavloite committed Jan 14, 2020
1 parent d2ed3bc commit a2be792
Showing 1 changed file with 3 additions and 2 deletions.
Expand Up @@ -163,8 +163,9 @@ public ResultSet answer(InvocationOnMock invocation) throws Throwable {
public ApiFuture<Empty> answer(InvocationOnMock invocation) throws Throwable {
synchronized (lock) {
if (expiredSessions.contains(session.getName())) {
throw SpannerExceptionFactory.newSpannerException(
ErrorCode.NOT_FOUND, "Session not found");
return ApiFutures.immediateFailedFuture(
SpannerExceptionFactory.newSpannerException(
ErrorCode.NOT_FOUND, "Session not found"));
}
if (sessions.remove(session.getName()) == null) {
setFailed(closedSessions.get(session.getName()));
Expand Down

0 comments on commit a2be792

Please sign in to comment.