main
1using System;
2using System.Windows.Forms;
3using Gorilla.Commons.Infrastructure.Container;
4using Gorilla.Commons.Infrastructure.Logging;
5using gorilla.commons.utility;
6using momoney.presentation.model.eventing;
7using MoMoney.Service.Infrastructure.Eventing;
8
9namespace MoMoney.boot
10{
11 class global_error_handling : Command
12 {
13 public void run()
14 {
15 Application.ThreadException += (sender, e) => handle(e.Exception);
16 AppDomain.CurrentDomain.UnhandledException += (o, e) => handle(e.ExceptionObject.downcast_to<Exception>());
17 }
18
19 void handle(Exception e)
20 {
21 e.add_to_log();
22 Resolve.the<IEventAggregator>().publish(new UnhandledErrorOccurred(e));
23 }
24 }
25}