internal static void ParseError(IRestResponse response, RequestType requestType) { ApiErrorResponse apiError = GetApiErrorResponse(response.Content); DracoonApiCode resultCode = Parse((int)response.StatusCode, response, apiError, requestType); DracoonClient.Log.Debug(LogTag, $"Query for '{requestType.ToString()}' failed with '{resultCode.Text}'"); throw new DracoonApiException(resultCode); }
internal static void ParseError(IRestResponse response, RequestType requestType) { OAuthError oauthError = GetOAuthError(response.Content); DracoonApiCode resultCode = Parse(response.StatusCode, oauthError, requestType); DracoonClient.Log.Debug(Logtag, $"Query for '{requestType.ToString()}' failed with {resultCode.Text}"); throw new DracoonApiException(resultCode); }
public void DracoonApiCode_ValidationError() { // ARRANGE DracoonApiCode code = DracoonApiCode.VALIDATION_BAD_FILE_NAME; // ACT // ASSERT Assert.True(code.IsValidationError()); }
public void DracoonApiCode_ServerError_Fail() { // ARRANGE DracoonApiCode code = DracoonApiCode.API_VERSION_NOT_SUPPORTED; // ACT // ASSERT Assert.False(code.IsServerError()); }
public void DracoonApiCode_PermissionError() { // ARRANGE DracoonApiCode code = DracoonApiCode.PERMISSION_DELETE_ERROR; // ACT // ASSERT Assert.True(code.IsPermissionError()); }
public void DracoonApiCode_ServerError() { // ARRANGE DracoonApiCode code = DracoonApiCode.SERVER_FILE_NOT_FOUND; // ACT // ASSERT Assert.True(code.IsServerError()); }
public void DracoonApiCode_PreconditionError() { // ARRANGE DracoonApiCode code = DracoonApiCode.PRECONDITION_MUST_ACCEPT_EULA; // ACT // ASSERT Assert.True(code.IsPreconditionError()); }
public void DracoonApiCode_AuthError() { // ARRANGE DracoonApiCode code = DracoonApiCode.AUTH_OAUTH_AUTHORIZATION_REQUEST_INVALID; // ACT // ASSERT Assert.True(code.IsAuthError()); }
public void DracoonApiCode_Equality_NotSameContent() { // ARRANGE DracoonApiCode object1 = DracoonApiCode.API_VERSION_NOT_SUPPORTED; object object2 = DracoonApiCode.AUTH_USER_TEMPORARY_LOCKED; // ACT // ASSERT Assert.False(object1.Equals(object2)); }
public void DracoonApiCode_Equality_SameContent() { // ARRANGE DracoonApiCode object1 = DracoonApiCode.API_VERSION_NOT_SUPPORTED; object object2 = DracoonApiCode.API_VERSION_NOT_SUPPORTED; // ACT // ASSERT Assert.True(object1.Equals(object2)); }
public void DracoonApiCode_Equality_OtherType() { // ARRANGE DracoonApiCode object1 = DracoonApiCode.API_VERSION_NOT_SUPPORTED; object object2 = "string"; // ACT // ASSERT Assert.False(object1.Equals(object2)); }
public void DracoonApiCode_Equality_null() { // ARRANGE DracoonApiCode object1 = DracoonApiCode.API_VERSION_NOT_SUPPORTED; object object2 = null; // ACT // ASSERT Assert.False(object1.Equals(object2)); }
public void DracoonApiCode_ToString() { // ARRANGE DracoonApiCode code = DracoonApiCode.PERMISSION_CREATE_ERROR; string expected = code.Code + " " + code.Text; // ACT string actual = code.ToString(); // ASSERT Assert.Equal(expected, actual); }
public void DracoonApiException_Constructor2() { // ARRANGE DracoonApiCode code = DracoonApiCode.SERVER_USER_NOT_FOUND; // ACT DracoonApiException exc = new DracoonApiException(code); // ASSERT Assert.IsAssignableFrom <DracoonException>(exc); Assert.IsAssignableFrom <Exception>(exc); Assert.Equal(code.Code, exc.ErrorCode.Code); }
internal static void ParseError(ApiErrorResponse apiError, RequestType requestType) { int code = 0; if (apiError.Code.HasValue) { code = apiError.Code.Value; } DracoonApiCode resultCode = Parse(code, null, apiError, requestType); throw new DracoonApiException(resultCode); }
internal static void ParseError(WebException exception, RequestType requestType) { if (exception.Status == WebExceptionStatus.ProtocolError) { ApiErrorResponse apiError = GetApiErrorResponse(ReadErrorResponseFromWebException(exception)); if (exception.Response is HttpWebResponse response) { DracoonApiCode resultCode = Parse((int)response.StatusCode, response, apiError, requestType); DracoonClient.Log.Debug(LogTag, $"Query for '{requestType.ToString()}' failed with '{resultCode.Text}'"); throw new DracoonApiException(resultCode); } throw new DracoonApiException(DracoonApiCode.SERVER_UNKNOWN_ERROR); } throw new DracoonNetIOException("The request for '" + requestType.ToString() + "' failed with '" + exception.Message + "'", exception); }
/// <include file = "ErrorDoc.xml" path='docs/members[@name="dracoonApiException"]/DracoonApiExceptionConstructorTwo/*'/> public DracoonApiException(DracoonApiCode errorCode) : base(errorCode.Text) { ErrorCode = errorCode; }
/// <include file = "ErrorDoc.xml" path='docs/members[@name="dracoonApiException"]/DracoonApiExceptionConstructorOne/*'/> public DracoonApiException() { ErrorCode = DracoonApiCode.SERVER_UNKNOWN_ERROR; }