Skip to content

Commit fe62163

Browse files
committed
Normalizing some interfaces to allow better extending them with the param objects[] @param stunt later.
1 parent 4c43d3c commit fe62163

16 files changed

Lines changed: 35 additions & 35 deletions

Source/ModuleManager/Logging/IBasicLogger.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace ModuleManager.Logging
2424
public interface IBasicLogger
2525
{
2626
void Log(K.Level logType, string message, params object[] @params);
27-
void Exception(string message, Exception exception);
27+
void Exception(Exception exception, string message);
2828
void Finish();
2929
}
3030
}

Source/ModuleManager/Logging/ModLogger.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ private ModLogger()
4141

4242
public void Log(K.Level logType, string message, params object[] @params) => this.methods[(int)logType](message, @params);
4343

44-
public void Exception(string message, Exception exception)
44+
public void Exception(Exception exception, string message)
4545
{
4646
LOG.error(exception, message);
4747
}

Source/ModuleManager/Logging/PatchLogger.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ internal PatchLogger(string filename)
4343

4444
public void Log(K.Level logType, string message, object[] @params) => this.methods[(int)logType](message, @params);
4545

46-
public void Exception(string message, Exception exception)
46+
public void Exception(Exception exception, string message)
4747
{
4848
this.log.error(exception, message);
4949
}

Source/ModuleManager/MMPatchLoader.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public IEnumerable<IProtoUrlConfig> Run()
9090
}
9191
catch (Exception ex)
9292
{
93-
logger.Exception("Exception in IsCacheUpToDate", ex);
93+
logger.Exception(ex, "Exception in IsCacheUpToDate");
9494
}
9595

9696
IEnumerable<IProtoUrlConfig> databaseConfigs = null;
@@ -190,7 +190,7 @@ public IEnumerable<IProtoUrlConfig> Run()
190190
}
191191
catch (Exception e)
192192
{
193-
patchLogger.Exception("Exception while deleting stale cache ", e);
193+
patchLogger.Exception(e, "Exception while deleting stale cache ");
194194
}
195195
}
196196
else
@@ -498,7 +498,7 @@ private void CreateCache(IEnumerable<IProtoUrlConfig> databaseConfigs, int patch
498498
}
499499
catch (Exception e)
500500
{
501-
logger.Exception("Exception while saving the sha", e);
501+
logger.Exception(e, "Exception while saving the sha");
502502
}
503503
try
504504
{
@@ -507,11 +507,11 @@ private void CreateCache(IEnumerable<IProtoUrlConfig> databaseConfigs, int patch
507507
}
508508
catch (NullReferenceException e)
509509
{
510-
logger.Exception("NullReferenceException while saving the cache", e);
510+
logger.Exception(e, "NullReferenceException while saving the cache");
511511
}
512512
catch (Exception e)
513513
{
514-
logger.Exception("Exception while saving the cache", e);
514+
logger.Exception(e, "Exception while saving the cache");
515515
}
516516

517517
try
@@ -522,7 +522,7 @@ private void CreateCache(IEnumerable<IProtoUrlConfig> databaseConfigs, int patch
522522
}
523523
catch (Exception e)
524524
{
525-
logger.Exception("Exception while deleting the cache", e);
525+
logger.Exception(e, "Exception while deleting the cache");
526526
}
527527
}
528528

Source/ModuleManager/MMPatchRunner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public IEnumerator Run()
7373

7474
if (patchingThreadStatus.IsExitedWithError)
7575
{
76-
kspLogger.Exception("The patching thread threw an exception", patchingThreadStatus.Exception);
76+
kspLogger.Exception(patchingThreadStatus.Exception, "The patching thread threw an exception");
7777
FatalErrorHandler.HandleFatalError("The patching thread threw an exception");
7878
yield break;
7979
}

Source/ModuleManager/ModListGenerator.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public static IEnumerable<string> GenerateModList(IEnumerable<ModAddedByAssembly
8585
}
8686
catch (Exception e)
8787
{
88-
progress.Exception("Exception while generating SHA for assembly " + assemblyName.Name, e);
88+
progress.Exception(e, "Exception while generating SHA for assembly " + assemblyName.Name);
8989
}
9090

9191
modListInfo.AppendFormat(
@@ -212,14 +212,14 @@ public static IEnumerable<ModAddedByAssembly> GetAdditionalModsFromStaticMethods
212212
}
213213
catch (Exception e)
214214
{
215-
logger.Exception("Exception while calling " + methodName, e);
215+
logger.Exception(e, "Exception while calling " + methodName);
216216
}
217217
}
218218
}
219219
}
220220
catch (Exception e)
221221
{
222-
logger.Exception("Add to mod list threw an exception in loading " + ass.FullName, e);
222+
logger.Exception(e, "Add to mod list threw an exception in loading " + ass.FullName);
223223
}
224224
}
225225

@@ -248,7 +248,7 @@ public static IEnumerable<ModAddedByAssembly> GetAdditionalModsFromStaticMethods
248248
}
249249
catch (Exception e)
250250
{
251-
logger.Exception("Exception while calling " + methodName, e);
251+
logger.Exception(e, "Exception while calling " + methodName);
252252
}
253253
}
254254
}

Source/ModuleManager/NeedsChecker.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,12 @@ private void CheckNeedsRecursive(NodeStack nodeStack, UrlDir.UrlConfig urlConfig
154154
}
155155
catch (ArgumentOutOfRangeException e)
156156
{
157-
progress.Exception("ArgumentOutOfRangeException in CheckNeeds for value \"" + val.name + "\"", e);
157+
progress.Exception(e, "ArgumentOutOfRangeException in CheckNeeds for value \"" + val.name + "\"");
158158
throw;
159159
}
160160
catch (Exception e)
161161
{
162-
progress.Exception("General Exception in CheckNeeds for value \"" + val.name + "\"", e);
162+
progress.Exception(e, "General Exception in CheckNeeds for value \"" + val.name + "\"");
163163
throw;
164164
}
165165
}
@@ -190,12 +190,12 @@ private void CheckNeedsRecursive(NodeStack nodeStack, UrlDir.UrlConfig urlConfig
190190
}
191191
catch (ArgumentOutOfRangeException e)
192192
{
193-
progress.Exception("ArgumentOutOfRangeException in CheckNeeds for node \"" + node.name + "\"", e);
193+
progress.Exception(e, "ArgumentOutOfRangeException in CheckNeeds for node \"" + node.name + "\"");
194194
throw;
195195
}
196196
catch (Exception e)
197197
{
198-
progress.Exception("General Exception " + e.GetType().Name + " for node \"" + node.name + "\"", e);
198+
progress.Exception(e, "General Exception " + e.GetType().Name + " for node \"" + node.name + "\"");
199199
throw;
200200
}
201201
}

Source/ModuleManager/PatchApplier.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ private void ApplyPatches(LinkedList<IProtoUrlConfig> databaseConfigs, IPass pas
6161
}
6262
catch (Exception e)
6363
{
64-
progress.Exception(patch.UrlConfig, "Exception while processing node : " + patch.UrlConfig.SafeUrl(), e);
64+
progress.Exception(e, patch.UrlConfig, "Exception while processing node : " + patch.UrlConfig.SafeUrl());
6565
logger.Error("Processed node was\n" + patch.UrlConfig.PrettyPrint());
6666
}
6767
}

Source/ModuleManager/PatchExtractor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public IPatch ExtractPatch(UrlDir.UrlConfig urlConfig)
124124
}
125125
catch(Exception e)
126126
{
127-
progress.Exception(urlConfig, $"Exception while attempting to create patch from config: {urlConfig.SafeUrl()}", e);
127+
progress.Exception(e, urlConfig, $"Exception while attempting to create patch from config: {urlConfig.SafeUrl()}");
128128
return null;
129129
}
130130
}

Source/ModuleManager/Patches/CopyPatch.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public void Apply(LinkedList<IProtoUrlConfig> databaseConfigs, IPatchProgress pr
6868
}
6969
catch (Exception ex)
7070
{
71-
progress.Exception(UrlConfig, $"Exception while applying copy {UrlConfig.SafeUrl()} to {protoConfig.FullUrl}", ex);
71+
progress.Exception(ex, UrlConfig, $"Exception while applying copy {UrlConfig.SafeUrl()} to {protoConfig.FullUrl}");
7272
}
7373
}
7474
}

0 commit comments

Comments
 (0)