From 4a47580bc9ddfbd25a6caa6f54656c0578a2b129 Mon Sep 17 00:00:00 2001 From: Sriparna Majumdar <37515344+majumdarsr@users.noreply.github.com> Date: Tue, 22 Feb 2022 11:25:24 -0800 Subject: [PATCH] Update DdpAccount.cs Updating logout method, so that it handles Ddperror and removes token before waiting to receive 'result' message from the server. --- unity-project/Assets/Moulin/DDP/account/DdpAccount.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/unity-project/Assets/Moulin/DDP/account/DdpAccount.cs b/unity-project/Assets/Moulin/DDP/account/DdpAccount.cs index a29a6c4..719ec1a 100644 --- a/unity-project/Assets/Moulin/DDP/account/DdpAccount.cs +++ b/unity-project/Assets/Moulin/DDP/account/DdpAccount.cs @@ -114,8 +114,13 @@ public IEnumerator ResumeSession(string token) { public IEnumerator Logout() { MethodCall logoutCall = connection.Call("logout"); - yield return logoutCall.WaitForResult(); + + if (logoutCall.error != null) { + throw new InvalidOperationException("Logout Error! Try Again!"); + } + HandleLogoutResult(logoutCall); + yield return logoutCall.WaitForResult(); } }