private void ThrowDeezerError(IError error) { if (error.Code == 200 || //200 == Logout fail error.Code == 300) //300 == Authentication error { //We've got an invalid/expired auth code -> auto logout + clear internals iSession.Logout(); iPermissions = null; iUser = null; } throw new DeezerException(error); }
private void ThrowIfDeezerExceptionAndLogout <T>(Task <IRestResponse <T> > aTask) where T : IHasError { var r = aTask.Result.Data; if (r.TheError != null) { //If we've got an invalid code, we auto logout + clear internals if (r.TheError.Code == 300) { iSession.Logout(); iPermissions = null; iUser = null; } throw new DeezerException(r.TheError); } }
private void CheckForDeezerError <T>(T aObject) where T : IHasError { if (aObject == null) { throw new InvalidOperationException("JSON response failed to be parsed into suitable object."); } //Make sure our API call didn't fail... if (aObject.TheError != null) { if (aObject.TheError.Code == 300) { //We've got an invalid/expired auth code -> auto logout + clear internals iSession.Logout(); iPermissions = null; iUser = null; } throw new DeezerException(aObject.TheError); } }
public void Logout() => iSession.Logout();
public void Logout() { iSession.Logout(); }