D2L.Extensibility.AuthSdk.D2LWebException.D2LWebException C# (CSharp) Method

D2LWebException() public method

Constructs a D2LWebException and if possible reads the HttpStatusCode and message body of the response from the Exception
public D2LWebException ( WebException ex ) : System.IO
ex System.Net.WebException The WebException to attempt to read the HttpStatusCode and message body from
return System.IO
        public D2LWebException( WebException ex )
        {
            if( ex != null ) {
                var castResponse = ex.Response as HttpWebResponse;
                if( castResponse != null ) {
                    m_statusCode = castResponse.StatusCode;
                    using( var stream = castResponse.GetResponseStream() ) {
                        if( stream != null ) {
                            using( var reader = new StreamReader( stream, Encoding.UTF8 ) ) {
                                m_responseBody = reader.ReadToEnd();
                            }
                        }
                    }
                }
            }
        }
D2LWebException