Skip to content

Commit

Permalink
Modified SignalRError
Browse files Browse the repository at this point in the history
  • Loading branch information
abnanda1 committed Apr 29, 2013
1 parent 81538f0 commit eaca449
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
Expand Up @@ -48,7 +48,7 @@ private static SignalRError GetWebExceptionError(Exception ex)

if (response != null)
{
error.SetHttpWebResponse(response);
error.SetResponse(response);
error.StatusCode = response.StatusCode;
Stream originStream = response.GetResponseStream();

Expand Down Expand Up @@ -82,7 +82,7 @@ private static SignalRError GetHttpClientException(Exception ex)

if (response != null)
{
error.SetResponseMessage(response);
error.SetResponse(response);
error.StatusCode = response.StatusCode;
error.ResponseBody = response.Content.ReadAsStringAsync().Result;
}
Expand Down
21 changes: 5 additions & 16 deletions src/Microsoft.AspNet.SignalR.Client/Infrastructure/SignalRError.cs
Expand Up @@ -11,8 +11,7 @@ namespace Microsoft.AspNet.SignalR.Client
/// </summary>
public class SignalRError : IDisposable
{
private HttpWebResponse _responseWeb;
private HttpResponseMessage _responseMessage;
private IDisposable _response;

/// <summary>
/// Create custom SignalR based error.
Expand All @@ -23,14 +22,9 @@ public SignalRError(Exception exception)
Exception = exception;
}

internal void SetHttpWebResponse(HttpWebResponse response)
internal void SetResponse(IDisposable response)
{
_responseWeb = response;
}

internal void SetResponseMessage(HttpResponseMessage response)
{
_responseMessage = response;
_response = response;
}

/// <summary>
Expand Down Expand Up @@ -61,14 +55,9 @@ protected virtual void Dispose(bool disposing)
{
if (disposing)
{
if (_responseWeb != null)
{
_responseWeb.Close();
}

if (_responseMessage != null)
if (_response != null)
{
_responseMessage.Dispose();
_response.Dispose();
}
}
}
Expand Down

0 comments on commit eaca449

Please sign in to comment.