Skip to content

Commit ea68319

Browse files
committed
replacing null-conditional operators with Exception.InnerException property
1 parent 16c8ac3 commit ea68319

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Assets/Scripts/UnityServices/Auth/AuthenticationServiceFacade.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public InitializationOptions GenerateAuthenticationOptions(string profile)
2727
}
2828
catch (Exception e)
2929
{
30-
var reason = $"{e.Message} ({e.InnerException?.Message})";
30+
var reason = e.InnerException == null ? e.Message : $"{e.Message} ({e.InnerException.Message})";
3131
m_UnityServiceErrorMessagePublisher.Publish(new UnityServiceErrorMessage("Authentication Error", reason, UnityServiceErrorMessage.Service.Authentication, e));
3232
throw;
3333
}
@@ -46,7 +46,7 @@ public async Task InitializeAndSignInAsync(InitializationOptions initializationO
4646
}
4747
catch (Exception e)
4848
{
49-
var reason = $"{e.Message} ({e.InnerException?.Message})";
49+
var reason = e.InnerException == null ? e.Message : $"{e.Message} ({e.InnerException.Message})";
5050
m_UnityServiceErrorMessagePublisher.Publish(new UnityServiceErrorMessage("Authentication Error", reason, UnityServiceErrorMessage.Service.Authentication, e));
5151
throw;
5252
}
@@ -67,7 +67,7 @@ public async Task SwitchProfileAndReSignInAsync(string profile)
6767
}
6868
catch (Exception e)
6969
{
70-
var reason = $"{e.Message} ({e.InnerException?.Message})";
70+
var reason = e.InnerException == null ? e.Message : $"{e.Message} ({e.InnerException.Message})";
7171
m_UnityServiceErrorMessagePublisher.Publish(new UnityServiceErrorMessage("Authentication Error", reason, UnityServiceErrorMessage.Service.Authentication, e));
7272
throw;
7373
}
@@ -87,7 +87,7 @@ public async Task<bool> EnsurePlayerIsAuthorized()
8787
}
8888
catch (AuthenticationException e)
8989
{
90-
var reason = $"{e.Message} ({e.InnerException?.Message})";
90+
var reason = e.InnerException == null ? e.Message : $"{e.Message} ({e.InnerException.Message})";
9191
m_UnityServiceErrorMessagePublisher.Publish(new UnityServiceErrorMessage("Authentication Error", reason, UnityServiceErrorMessage.Service.Authentication, e));
9292

9393
//not rethrowing for authentication exceptions - any failure to authenticate is considered "handled failure"
@@ -96,7 +96,7 @@ public async Task<bool> EnsurePlayerIsAuthorized()
9696
catch (Exception e)
9797
{
9898
//all other exceptions should still bubble up as unhandled ones
99-
var reason = $"{e.Message} ({e.InnerException?.Message})";
99+
var reason = e.InnerException == null ? e.Message : $"{e.Message} ({e.InnerException.Message})";
100100
m_UnityServiceErrorMessagePublisher.Publish(new UnityServiceErrorMessage("Authentication Error", reason, UnityServiceErrorMessage.Service.Authentication, e));
101101
throw;
102102
}

Assets/Scripts/UnityServices/Lobbies/LobbyServiceFacade.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ public void DoLobbyHeartbeat(float dt)
548548

549549
void PublishError(LobbyServiceException e)
550550
{
551-
var reason = $"{e.Message} ({e.InnerException?.Message})"; // Lobby error type, then HTTP error type.
551+
var reason = e.InnerException == null ? e.Message : $"{e.Message} ({e.InnerException.Message})"; // Lobby error type, then HTTP error type.
552552
m_UnityServiceErrorMessagePub.Publish(new UnityServiceErrorMessage("Lobby Error", reason, UnityServiceErrorMessage.Service.Lobby, e));
553553
}
554554
}

0 commit comments

Comments
 (0)