private async Task <bool> CreateAccountAsync( CreateAccountPersonInfo createAccountPersonInfo, CancellationToken cancelToken) { try { return(await m_client.CreateAccountAsync(createAccountPersonInfo, cancelToken)); } catch (ServerException se) { switch (se.StatusCode) { case (int)ServerStatusCode.InvalidAge: m_serverErrorNumber = ServerErrorNumber.InvalidAge; break; case (int)ServerStatusCode.InvalidIPAddress: m_serverErrorNumber = ServerErrorNumber.InvalidIPAddress; break; case (int)ServerStatusCode.InvalidPerson: m_serverErrorNumber = ServerErrorNumber.InvalidPerson; break; case (int)ServerStatusCode.DuplicateCredentialFound: m_serverErrorNumber = ServerErrorNumber.DuplicateCredentialFound; break; } throw; } }
public static TestRemoteStore CreateServerErrorProducer(IRemoteItemStore inner, IList <ServerErrorNumber> errors) { TestRemoteStore store = new TestRemoteStore(inner); Random rand = new Random(); store.ErrorThrower = delegate() { ServerErrorNumber error = 0; lock (rand) { error = errors[rand.Next(0, errors.Count - 1)]; } ServerStatusCode code = (ServerStatusCode)((uint)error - (uint)HResults.ServerErrorBase); throw new ServerException(code); }; return(store); }
public void HandledServerError() { m_serverErrorNumber = 0; }
internal static (int, string, string) SetServerError(ServerErrorNumber e) { return((int)e, Errors[(int)e].ErrorMessage, Errors[(int)e].ErrorDetails); }
// This constructor creates an error object with the error number and error message filled in public ServerError(ServerErrorNumber e) { (ErrorNumber, ErrorMessage, ErrorDetails) = ServerErrors.SetServerError(e); }
private async Task<bool> CreateAccountAsync( CreateAccountPersonInfo createAccountPersonInfo, CancellationToken cancelToken) { try { return await m_client.CreateAccountAsync(createAccountPersonInfo, cancelToken); } catch (ServerException se) { switch (se.StatusCode) { case (int)ServerStatusCode.InvalidAge: m_serverErrorNumber = ServerErrorNumber.InvalidAge; break; case (int)ServerStatusCode.InvalidIPAddress: m_serverErrorNumber = ServerErrorNumber.InvalidIPAddress; break; case (int)ServerStatusCode.InvalidPerson: m_serverErrorNumber = ServerErrorNumber.InvalidPerson; break; case (int)ServerStatusCode.DuplicateCredentialFound: m_serverErrorNumber = ServerErrorNumber.DuplicateCredentialFound; break; } throw; } }