Updated the Stat Tracker to use System.Net.Http types.
Very similar to the previous Update Manager changes. The stat tracker now uses asynchronous threaded calls and manages exceptions better
This commit is contained in:
parent
26a5b00567
commit
b3a2b24daa
5 changed files with 198 additions and 104 deletions
27
TShockAPI/Extensions/ExceptionExt.cs
Normal file
27
TShockAPI/Extensions/ExceptionExt.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
using System;
|
||||
namespace TShockAPI.Extensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Extensions for Exceptions
|
||||
/// </summary>
|
||||
public static class ExceptionExt
|
||||
{
|
||||
/// <summary>
|
||||
/// Builds a formatted string containing the messages of the given exception, and any inner exceptions it contains
|
||||
/// </summary>
|
||||
/// <param name="ex"></param>
|
||||
/// <returns></returns>
|
||||
public static string BuildExceptionString(this Exception ex)
|
||||
{
|
||||
string msg = ex.Message;
|
||||
Exception inner = ex.InnerException;
|
||||
while (inner != null)
|
||||
{
|
||||
msg += $"\r\n\t-> {inner.Message}";
|
||||
inner = inner.InnerException;
|
||||
}
|
||||
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue