diff options
author | Tedd Hansen | 2008-01-12 01:25:35 +0000 |
---|---|---|
committer | Tedd Hansen | 2008-01-12 01:25:35 +0000 |
commit | adbdbc675bcac123f3dcbc6ff81c3f811e4b44f1 (patch) | |
tree | 4cf9eb16b26a49175c7b304552df9324bc471e5e /OpenSim | |
parent | New ScriptServer protocol successfully implemented. (diff) | |
download | opensim-SC-adbdbc675bcac123f3dcbc6ff81c3f811e4b44f1.zip opensim-SC-adbdbc675bcac123f3dcbc6ff81c3f811e4b44f1.tar.gz opensim-SC-adbdbc675bcac123f3dcbc6ff81c3f811e4b44f1.tar.bz2 opensim-SC-adbdbc675bcac123f3dcbc6ff81c3f811e4b44f1.tar.xz |
Added global exception handler with possibility of reporting crash details directly to developers (disabled for now)
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Application/Application.cs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index cb3bd40..de58a8c 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Net; | ||
29 | using Nini.Config; | 30 | using Nini.Config; |
30 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
31 | using OpenSim.Framework.Console; | 32 | using OpenSim.Framework.Console; |
@@ -38,6 +39,8 @@ namespace OpenSim | |||
38 | [STAThread] | 39 | [STAThread] |
39 | public static void Main(string[] args) | 40 | public static void Main(string[] args) |
40 | { | 41 | { |
42 | AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); | ||
43 | |||
41 | Console.WriteLine("OpenSim " + VersionInfo.Version + "\n"); | 44 | Console.WriteLine("OpenSim " + VersionInfo.Version + "\n"); |
42 | 45 | ||
43 | 46 | ||
@@ -76,5 +79,41 @@ namespace OpenSim | |||
76 | MainLog.Instance.MainLogPrompt(); | 79 | MainLog.Instance.MainLogPrompt(); |
77 | } | 80 | } |
78 | } | 81 | } |
82 | |||
83 | /// <summary> | ||
84 | /// Global exception handler -- all unhandlet exceptions end up here :) | ||
85 | /// </summary> | ||
86 | /// <param name="sender"></param> | ||
87 | /// <param name="e"></param> | ||
88 | private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) | ||
89 | { | ||
90 | // TODO: Add config option to allow users to turn off error reporting | ||
91 | // TODO: Post error report (disabled for now) | ||
92 | |||
93 | string msg = ""; | ||
94 | msg += "\r\n"; | ||
95 | msg += "APPLICATION EXCEPTION DETECTED\r\n"; | ||
96 | msg += "\r\n"; | ||
97 | msg += "Application is terminating: " + e.IsTerminating.ToString() + "\r\n"; | ||
98 | msg += "Exception:"; | ||
99 | msg += e.ExceptionObject.ToString(); | ||
100 | Console.WriteLine(msg); | ||
101 | |||
102 | // Try to post errormessage to an URL | ||
103 | try | ||
104 | { | ||
105 | // DISABLED UNTIL WE CAN DISCUSS IF THIS IS MORALLY RIGHT OR NOT | ||
106 | // Note! Needs reference to System.Web | ||
107 | //System.Net.WebClient wc = new WebClient(); | ||
108 | //wc.DownloadData("http://www.opensimulator.org/ErrorReport.php?Msg=" + | ||
109 | // System.Web.HttpUtility.UrlEncode(msg)); | ||
110 | //wc.Dispose(); | ||
111 | } | ||
112 | catch (Exception) | ||
113 | { | ||
114 | // Ignore | ||
115 | } | ||
116 | } | ||
117 | |||
79 | } | 118 | } |
80 | } \ No newline at end of file | 119 | } \ No newline at end of file |