<commit_before>﻿using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Windows;
using Caliburn.Micro;

namespace TypedRest.Wpf
{
    public class Bootstrapper<T> : BootstrapperBase
    {
        public Bootstrapper()
        {
            Initialize();
        }

        protected override IEnumerable<Assembly> SelectAssemblies()
        {
            return base.SelectAssemblies().Concat(new[] {Assembly.GetExecutingAssembly()});
        }

        protected override void OnStartup(object sender, StartupEventArgs e)
        {
            DisplayRootViewFor<T>();
        }<commit_msg>TypedRest.Wpf: Basic error handling<commit_after>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Reflection;
using System.Windows;
using System.Windows.Threading;
using Caliburn.Micro;

namespace TypedRest.Wpf
{
    public class Bootstrapper<T> : BootstrapperBase
    {
        public Bootstrapper()
        {
            Initialize();
        }

        protected override IEnumerable<Assembly> SelectAssemblies()
        {
            return base.SelectAssemblies().Concat(new[] {Assembly.GetExecutingAssembly()});
        }

        protected override void OnStartup(object sender, StartupEventArgs e)
        {
            DisplayRootViewFor<T>();
        }

        protected override void OnUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
        {
            if (e.Exception is InvalidDataException
                || e.Exception is UnauthorizedAccessException
                || e.Exception is KeyNotFoundException
                || e.Exception is InvalidOperationException
                || e.Exception is IndexOutOfRangeException
                || e.Exception is HttpRequestException)
            {
                MessageBox.Show(e.Exception.Message, "REST error",
                    MessageBoxButton.OK, MessageBoxImage.Error);
                e.Handled = true;
            }
            else if (e.Exception is OperationCanceledException)
                e.Handled = true;

            base.OnUnhandledException(sender, e);
        }
{'fraction_non_alphanumeric': 0.08222324299494717, 'fraction_numerical': 0.0, 'mean_word_length': 2.2900302114803623, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '5368978', 'n_tokens_mistral': 559, 'n_tokens_neox': 545, 'n_words': 121}