Handling and logging exceptions thrown by ItemComponent constructors, added stack traces to a couple of error messages
This commit is contained in:
+1
-1
@@ -200,7 +200,7 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
string errorMsg = "Failed to read event for entity \"" + entity.ToString() + "\"! (MidRoundSyncing: " + thisClient.MidRoundSyncing + ")\n" + e.StackTrace;
|
string errorMsg = "Failed to read event for entity \"" + entity.ToString() + "\" (" + e.Message + ")! (MidRoundSyncing: " + thisClient.MidRoundSyncing + ")\n" + e.StackTrace;
|
||||||
errorMsg += "\nPrevious entities:";
|
errorMsg += "\nPrevious entities:";
|
||||||
for (int j = entities.Count - 2; j >= 0; j--)
|
for (int j = entities.Count - 2; j >= 0; j--)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -632,11 +632,22 @@ namespace Barotrauma.Items.Components
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
object[] lobject = new object[] { item, element };
|
ItemComponent ic = null;
|
||||||
object component = constructor.Invoke(lobject);
|
try
|
||||||
|
{
|
||||||
|
object[] lobject = new object[] { item, element };
|
||||||
|
object component = constructor.Invoke(lobject);
|
||||||
|
|
||||||
ItemComponent ic = (ItemComponent)component;
|
ic = (ItemComponent)component;
|
||||||
ic.name = element.Name.ToString();
|
ic.name = element.Name.ToString();
|
||||||
|
}
|
||||||
|
catch (TargetInvocationException e)
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError("Error while loading entity of the type " + t + ".", e.InnerException);
|
||||||
|
GameAnalyticsManager.AddErrorEventOnce("ItemComponent.Load:TargetInvocationException" + item.Name + element.Name,
|
||||||
|
GameAnalyticsSDK.Net.EGAErrorSeverity.Error,
|
||||||
|
"Error while loading entity of the type " + t + " (" + e.InnerException + ")\n" + Environment.StackTrace);
|
||||||
|
}
|
||||||
|
|
||||||
return ic;
|
return ic;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ namespace Barotrauma
|
|||||||
GameAnalyticsManager.AddErrorEventOnce(
|
GameAnalyticsManager.AddErrorEventOnce(
|
||||||
"Entity.RemoveAll:Exception" + e.ToString(),
|
"Entity.RemoveAll:Exception" + e.ToString(),
|
||||||
GameAnalyticsSDK.Net.EGAErrorSeverity.Error,
|
GameAnalyticsSDK.Net.EGAErrorSeverity.Error,
|
||||||
"Error while removing entity \"" + e.ToString() + "\"" + exception.Message);
|
"Error while removing entity \"" + e.ToString() + " (" + exception.Message + ")\n" + exception.StackTrace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StringBuilder errorMsg = new StringBuilder();
|
StringBuilder errorMsg = new StringBuilder();
|
||||||
|
|||||||
Reference in New Issue
Block a user