<commit_before>﻿using System;
using System.IO;
using System.Net;

namespace SODA
{
    public class SodaException : Exception
    {
        private SodaException(string message, Exception inner) : base(message, inner) { }

        public static SodaException Wrap(WebException webException)
        {
            string message = String.Empty;

            if (webException.Response != null)
            {
                using (var stream = webException.Response.GetResponseStream())
                {
                    message = new StreamReader(stream).ReadToEnd();
                }
            }

            return new SodaException(message, webException);
        }

        public static SodaException Wrap(Exception ex, string message = "")
        {
            return new SodaException(message, ex);
        }
    }
}<commit_msg>capture the exception message if response is null<commit_after>﻿using System;
using System.IO;
using System.Net;

namespace SODA
{
    public class SodaException : Exception
    {
        private SodaException(string message, Exception inner) : base(message, inner) { }

        public static SodaException Wrap(WebException webException)
        {
            string message = String.Empty;

            if (webException.Response != null)
            {
                using (var stream = webException.Response.GetResponseStream())
                {
                    message = new StreamReader(stream).ReadToEnd();
                }
            }
            else
            {
                message = webException.Message;
            }

            return new SodaException(message, webException);
        }

        public static SodaException Wrap(Exception ex, string message = "")
        {
            return new SodaException(message, ex);
        }
    }
}
{'fraction_non_alphanumeric': 0.07887479316050745, 'fraction_numerical': 0.0, 'mean_word_length': 1.777947932618683, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6409955', 'n_tokens_mistral': 447, 'n_tokens_neox': 426, 'n_words': 114}