mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Made Utils.LogToFile private. Removed ExceptionToString
This commit is contained in:
parent
bf87746e69
commit
e946fc7ea4
@ -83,7 +83,7 @@ namespace Wabbajack.Common
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Utils.LogToFile($"Error while setting process priority level for innounp.exe\n{e}");
|
Utils.Error(e, "Error while setting process priority level for innounp.exe");
|
||||||
}
|
}
|
||||||
|
|
||||||
var name = Path.GetFileName(source);
|
var name = Path.GetFileName(source);
|
||||||
@ -104,7 +104,7 @@ namespace Wabbajack.Common
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Utils.LogToFile($"Error while reading StandardOutput for innounp.exe\n{e}");
|
Utils.Error(e, "Error while reading StandardOutput for innounp.exe");
|
||||||
}
|
}
|
||||||
|
|
||||||
p.WaitForExit();
|
p.WaitForExit();
|
||||||
|
@ -18,6 +18,7 @@ using IniParser;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
using Wabbajack.Common.StatusFeed;
|
using Wabbajack.Common.StatusFeed;
|
||||||
|
using Wabbajack.Common.StatusFeed.Errors;
|
||||||
using YamlDotNet.Serialization;
|
using YamlDotNet.Serialization;
|
||||||
using YamlDotNet.Serialization.NamingConventions;
|
using YamlDotNet.Serialization.NamingConventions;
|
||||||
using Directory = System.IO.Directory;
|
using Directory = System.IO.Directory;
|
||||||
@ -68,9 +69,20 @@ namespace Wabbajack.Common
|
|||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void Error(Exception ex, string extraMessage = null)
|
||||||
|
{
|
||||||
|
Log(new GenericException(ex, extraMessage));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ErrorThrow(Exception ex, string extraMessage = null)
|
||||||
|
{
|
||||||
|
Error(ex, extraMessage);
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
|
||||||
public static void Error(IException err)
|
public static void Error(IException err)
|
||||||
{
|
{
|
||||||
LogToFile(err.ShortDescription);
|
LogToFile($"{err.ShortDescription}\n{err.Exception.StackTrace}");
|
||||||
LoggerSubj.OnNext(err);
|
LoggerSubj.OnNext(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +92,7 @@ namespace Wabbajack.Common
|
|||||||
throw err.Exception;
|
throw err.Exception;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void LogToFile(string msg)
|
private static void LogToFile(string msg)
|
||||||
{
|
{
|
||||||
lock (_lock)
|
lock (_lock)
|
||||||
{
|
{
|
||||||
@ -590,11 +602,6 @@ namespace Wabbajack.Common
|
|||||||
return stream.Result;
|
return stream.Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string ExceptionToString(this Exception ex)
|
|
||||||
{
|
|
||||||
return ex.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IEnumerable<T> DistinctBy<T, V>(this IEnumerable<T> vs, Func<T, V> select)
|
public static IEnumerable<T> DistinctBy<T, V>(this IEnumerable<T> vs, Func<T, V> select)
|
||||||
{
|
{
|
||||||
var set = new HashSet<V>();
|
var set = new HashSet<V>();
|
||||||
|
@ -42,7 +42,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Utils.LogToFile($"Exception while trying to evolve source to FromSteam\n{e}");
|
Utils.Error(e, $"Exception while trying to evolve source to FromSteam");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ namespace Wabbajack.Lib.Downloaders
|
|||||||
|
|
||||||
if (stream.IsFaulted || response.StatusCode != HttpStatusCode.OK)
|
if (stream.IsFaulted || response.StatusCode != HttpStatusCode.OK)
|
||||||
{
|
{
|
||||||
Utils.Log($"While downloading {Url} - {stream.Exception.ExceptionToString()}");
|
Utils.Error(stream.Exception, $"While downloading {Url}");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,9 +238,7 @@ namespace Wabbajack.Lib
|
|||||||
}
|
}
|
||||||
catch (JsonSerializationException e)
|
catch (JsonSerializationException e)
|
||||||
{
|
{
|
||||||
Info("Failed to parse vortex.deployment.json!");
|
Utils.Error(e, "Failed to parse vortex.deployment.json!");
|
||||||
Utils.LogToFile(e.Message);
|
|
||||||
Utils.LogToFile(e.StackTrace);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VortexDeployment.files.Do(f =>
|
VortexDeployment.files.Do(f =>
|
||||||
@ -352,7 +350,7 @@ namespace Wabbajack.Lib
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Utils.LogToFile($"Exception while writing to disk at {filePath}\n{e}");
|
Utils.Error(e, $"Exception while writing to disk at {filePath}");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ namespace Wabbajack
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
while (ex.InnerException != null) ex = ex.InnerException;
|
while (ex.InnerException != null) ex = ex.InnerException;
|
||||||
Utils.Log($"Compiler error: {ex.ExceptionToString()}");
|
Utils.Error(ex, $"Compiler error");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ namespace Wabbajack
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
while (ex.InnerException != null) ex = ex.InnerException;
|
while (ex.InnerException != null) ex = ex.InnerException;
|
||||||
Utils.Log($"Compiler error: {ex.ExceptionToString()}");
|
Utils.Error(ex, $"Compiler error");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -103,7 +103,7 @@ namespace Wabbajack
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
while (ex.InnerException != null) ex = ex.InnerException;
|
while (ex.InnerException != null) ex = ex.InnerException;
|
||||||
Utils.Log($"Compiler error: {ex.ExceptionToString()}");
|
Utils.Error(ex, $"Compiler error");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await Task.Run(async () =>
|
await Task.Run(async () =>
|
||||||
@ -115,7 +115,7 @@ namespace Wabbajack
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
while (ex.InnerException != null) ex = ex.InnerException;
|
while (ex.InnerException != null) ex = ex.InnerException;
|
||||||
Utils.Log($"Compiler error: {ex.ExceptionToString()}");
|
Utils.Error(ex, $"Compiler error");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -61,7 +61,7 @@ namespace Wabbajack
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Utils.LogToFile($"Exception while caching Mod List image {Name}\n{ex.ExceptionToString()}");
|
Utils.Error(ex, $"Exception while caching Mod List image {Name}");
|
||||||
return default(MemoryStream);
|
return default(MemoryStream);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -80,7 +80,7 @@ namespace Wabbajack
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Utils.LogToFile($"Exception while caching Mod List image {Name}\n{ex.ExceptionToString()}");
|
Utils.Error(ex, $"Exception while caching Mod List image {Name}");
|
||||||
return default(BitmapImage);
|
return default(BitmapImage);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -59,7 +59,7 @@ namespace Wabbajack
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Utils.LogToFile($"Exception while caching slide {ModName} ({ModID})\n{ex.ExceptionToString()}");
|
Utils.Error(ex, $"Exception while caching slide {ModName} ({ModID})");
|
||||||
return default(MemoryStream);
|
return default(MemoryStream);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -79,7 +79,7 @@ namespace Wabbajack
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Utils.LogToFile($"Exception while caching slide {ModName} ({ModID})\n{ex.ExceptionToString()}");
|
Utils.Error(ex, $"Exception while caching slide {ModName} ({ModID})");
|
||||||
return default(BitmapImage);
|
return default(BitmapImage);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -23,8 +23,7 @@ namespace Wabbajack
|
|||||||
AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
|
AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
|
||||||
{
|
{
|
||||||
// Don't do any special logging side effects
|
// Don't do any special logging side effects
|
||||||
Wabbajack.Common.Utils.Log("Uncaught error:");
|
Wabbajack.Common.Utils.Error(((Exception)e.ExceptionObject), "Uncaught error");
|
||||||
Wabbajack.Common.Utils.Log(((Exception)e.ExceptionObject).ExceptionToString());
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var appPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
|
var appPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user