Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Code review issues

  • Loading branch information...
commit fc2cb91be19fe0410fd0ad9624d72e240f9f073c 1 parent fb80061
Aliaksei Baturytski authored
View
10 ...zure-servicelayer/Microsoft.WindowsAzure.ServiceLayer.UnitTests.MsTest/HttpTests/HttpErrorHelperTests.cs
@@ -35,8 +35,8 @@ public class HttpErrorHelperTests
[TestMethod]
public void InvalidErrorSource()
{
- Assert.ThrowsException<ArgumentOutOfRangeException>(() => HttpErrorHelper.CreateComErrorCode((ErrorSource)(-1), 200));
- Assert.ThrowsException<ArgumentOutOfRangeException>(() => HttpErrorHelper.CreateComErrorCode((ErrorSource)2, 200));
+ Assert.ThrowsException<ArgumentOutOfRangeException>(() => HttpErrorHelper.CreateComErrorCode((WindowsAzureErrorSource)(-1), 200));
+ Assert.ThrowsException<ArgumentOutOfRangeException>(() => HttpErrorHelper.CreateComErrorCode((WindowsAzureErrorSource)2, 200));
}
/// <summary>
@@ -45,7 +45,7 @@ public void InvalidErrorSource()
[TestMethod]
public void InvalidHttpStatus()
{
- Assert.ThrowsException<ArgumentOutOfRangeException>(() => HttpErrorHelper.CreateComErrorCode(ErrorSource.ServiceBus, -1));
+ Assert.ThrowsException<ArgumentOutOfRangeException>(() => HttpErrorHelper.CreateComErrorCode(WindowsAzureErrorSource.ServiceBus, -1));
}
/// <summary>
@@ -54,8 +54,8 @@ public void InvalidHttpStatus()
[TestMethod]
public void InvalidComErrorCode()
{
- int validCode = HttpErrorHelper.CreateComErrorCode(ErrorSource.ServiceBus, 400);
- ErrorSource source;
+ int validCode = HttpErrorHelper.CreateComErrorCode(WindowsAzureErrorSource.ServiceBus, 400);
+ WindowsAzureErrorSource source;
int code;
Assert.ThrowsException<ArgumentException>(() => HttpErrorHelper.ParseComErrorCode(validCode & 0x7FFFFFFF, out source, out code)); // Invalid severity.
View
12 microsoft-azure-servicelayer/Microsoft.WindowsAzure.ServiceLayer/Http/HttpErrorHelper.cs
@@ -47,9 +47,9 @@ public static class HttpErrorHelper
/// <param name="source">The source of error.</param>
/// <param name="httpStatusCode">HTTP status code.</param>
/// <returns>HRESULT with embedded source and status code.</returns>
- public static int CreateComErrorCode(ErrorSource source, int httpStatusCode)
+ public static int CreateComErrorCode(WindowsAzureErrorSource source, int httpStatusCode)
{
- Validator.ArgumentIsValidEnumValue<ErrorSource>("source", source);
+ Validator.ArgumentIsValidEnumValue<WindowsAzureErrorSource>("source", source);
Validator.ArgumentIsValidEnumValue<System.Net.HttpStatusCode>("httpStatusCode", httpStatusCode);
// 10 bits should be enough for the error code!
@@ -66,7 +66,7 @@ public static int CreateComErrorCode(ErrorSource source, int httpStatusCode)
/// <param name="comErrorCode">COM error code (HRESULT).</param>
/// <param name="source">Error source.</param>
/// <param name="httpStatusCode">HTTP status code.</param>
- public static void ParseComErrorCode(int comErrorCode, out ErrorSource source, out int httpStatusCode)
+ public static void ParseComErrorCode(int comErrorCode, out WindowsAzureErrorSource source, out int httpStatusCode)
{
if (!TryParseComErrorCode(comErrorCode, out source, out httpStatusCode))
{
@@ -82,7 +82,7 @@ public static void ParseComErrorCode(int comErrorCode, out ErrorSource source, o
/// <param name="source">Error source.</param>
/// <param name="httpStatusCode">HTTP status code.</param>
/// <returns>True if COM error code was successfully parsed.</returns>
- public static bool TryParseComErrorCode(int comErrorCode, out ErrorSource source, out int httpStatusCode)
+ public static bool TryParseComErrorCode(int comErrorCode, out WindowsAzureErrorSource source, out int httpStatusCode)
{
source = 0;
httpStatusCode = 0;
@@ -92,8 +92,8 @@ public static bool TryParseComErrorCode(int comErrorCode, out ErrorSource source
return false;
}
- ErrorSource tempErrorSource = (ErrorSource)((comErrorCode & ErrorSourceMask) >> ErrorSourceOffset);
- if (!Enum.IsDefined(typeof(ErrorSource), tempErrorSource))
+ WindowsAzureErrorSource tempErrorSource = (WindowsAzureErrorSource)((comErrorCode & ErrorSourceMask) >> ErrorSourceOffset);
+ if (!Enum.IsDefined(typeof(WindowsAzureErrorSource), tempErrorSource))
{
return false;
}
View
4 microsoft-azure-servicelayer/Microsoft.WindowsAzure.ServiceLayer/Http/WindowsAzureHttpException.cs
@@ -34,7 +34,7 @@ internal class WindowsAzureHttpException: WindowsAzureException
/// <param name="message">Error message.</param>
/// <param name="response">HTTP response.</param>
internal WindowsAzureHttpException(string message, HttpResponse response)
- : this(message, ErrorSource.ServiceBus, response)
+ : this(message, WindowsAzureErrorSource.ServiceBus, response)
{
}
@@ -44,7 +44,7 @@ internal WindowsAzureHttpException(string message, HttpResponse response)
/// <param name="message">Short error message.</param>
/// <param name="source">Error source.</param>
/// <param name="response">HTTP response that triggered the exception.</param>
- protected WindowsAzureHttpException(string message, ErrorSource source, HttpResponse response)
+ protected WindowsAzureHttpException(string message, WindowsAzureErrorSource source, HttpResponse response)
: base(GetHttpErrorMessage(message, response))
{
HResult = HttpErrorHelper.CreateComErrorCode(source, response.StatusCode);
View
2  microsoft-azure-servicelayer/Microsoft.WindowsAzure.ServiceLayer/Http/WrapAuthenticationException.cs
@@ -32,7 +32,7 @@ internal class WrapAuthenticationException: WindowsAzureHttpException
/// </summary>
/// <param name="response">Response.</param>
internal WrapAuthenticationException(HttpResponse response)
- : base(Resources.ErrorWrapAuthentication, ErrorSource.WrapAuthentication, response)
+ : base(Resources.ErrorWrapAuthentication, WindowsAzureErrorSource.WrapAuthentication, response)
{
}
}
View
2  microsoft-azure-servicelayer/Microsoft.WindowsAzure.ServiceLayer/Microsoft.WindowsAzure.ServiceLayer.csproj
@@ -105,7 +105,7 @@
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
- <Compile Include="ErrorSource.cs" />
+ <Compile Include="WindowsAzureErrorSource.cs" />
<Compile Include="Http\HttpChannel.cs" />
<Compile Include="Http\HttpContent.cs" />
<Compile Include="Http\HttpDefaultHandler.cs" />
View
2  ...icrosoft.WindowsAzure.ServiceLayer/ErrorSource.cs → ...dowsAzure.ServiceLayer/WindowsAzureErrorSource.cs
@@ -24,7 +24,7 @@ namespace Microsoft.WindowsAzure.ServiceLayer
/// <summary>
/// Specifies source of an error.
/// </summary>
- public enum ErrorSource
+ public enum WindowsAzureErrorSource
{
ServiceBus, // The error comes from the service bus call.
WrapAuthentication, // The error comes from WRAP authentication call.
Please sign in to comment.
Something went wrong with that request. Please try again.