Example #1
0
        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);
        }
Example #2
0
        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);
            }
        }
Example #3
0
        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);
            }
        }
Example #4
0
 public void Logout() => iSession.Logout();
Example #5
0
 public void Logout()
 {
     iSession.Logout();
 }