- Some of the non-game-crashing error messages are sent to GameAnalytics.

- Changed crash severity from Error to Critical.
- Exception handling when loading submarine preview images.
- Checking if position is valid in Ragdoll.SetPosition.
This commit is contained in:
Joonas Rikkonen
2018-07-19 21:13:18 +03:00
parent 7756cc0908
commit f1c4bd3c67
13 changed files with 109 additions and 17 deletions
@@ -81,6 +81,9 @@ namespace Barotrauma
if (Limbs == null)
{
DebugConsole.ThrowError("Failed to draw a ragdoll, limbs have been removed. Character: \"" + character.Name + "\", removed: " + character.Removed + "\n" + Environment.StackTrace);
GameAnalyticsManager.AddErrorEventOnce("Ragdoll.Draw:LimbsRemoved",
GameAnalyticsSDK.Net.EGAErrorSeverity.Error,
"Failed to draw a ragdoll, limbs have been removed. Character: \"" + character.Name + "\", removed: " + character.Removed + "\n" + Environment.StackTrace);
return;
}
@@ -1020,29 +1020,32 @@ namespace Barotrauma.Networking
ChatMessage.ClientRead(inc);
break;
default:
DebugConsole.ThrowError("Error while reading update from server (unknown object header \""+objHeader+"\"!)");
if (prevObjHeader != null)
List<string> errorLines = new List<string>
{
DebugConsole.ThrowError("Previous object type: " + prevObjHeader.ToString());
}
else
{
DebugConsole.ThrowError("Error occurred on the very first object!");
}
DebugConsole.ThrowError("Previous object was " + (inc.Position - prevBitPos) + " bits long (" + (inc.PositionInBytes - prevBytePos) + " bytes)");
"Error while reading update from server (unknown object header \"" + objHeader + "\"!)",
prevObjHeader != null ? "Previous object type: " + prevObjHeader.ToString() : "Error occurred on the very first object!",
"Previous object was " + (inc.Position - prevBitPos) + " bits long (" + (inc.PositionInBytes - prevBytePos) + " bytes)"
};
if (prevObjHeader == ServerNetObject.ENTITY_EVENT || prevObjHeader == ServerNetObject.ENTITY_EVENT_INITIAL)
{
foreach (IServerSerializable ent in entities)
{
if (ent == null)
{
DebugConsole.ThrowError(" - NULL");
errorLines.Add(" - NULL");
continue;
}
Entity e = ent as Entity;
DebugConsole.ThrowError(" - "+e.ToString());
errorLines.Add(" - " + e.ToString());
}
}
foreach (string line in errorLines)
{
DebugConsole.ThrowError(line);
}
GameAnalyticsManager.AddErrorEventOnce("GameClient.ReadInGameUpdate", GameAnalyticsSDK.Net.EGAErrorSeverity.Critical, string.Join("\n", errorLines));
DebugConsole.ThrowError("Writing object data to \"crashreport_object.bin\", please send this file to us at http://github.com/Regalis11/Barotrauma/issues");
FileStream fl = File.Open("crashreport_object.bin", FileMode.Create);
@@ -191,6 +191,9 @@ namespace Barotrauma.Networking
if (GameSettings.VerboseLogging)
{
DebugConsole.ThrowError("Failed to read event for entity \"" + entity.ToString() + "\"!", e);
GameAnalyticsManager.AddErrorEventOnce("ClientEntityEventManager.Read:ReadFailed" + entity.ToString(),
GameAnalyticsSDK.Net.EGAErrorSeverity.Error,
"Failed to read event for entity \"" + entity.ToString() + "\"!\n" + e.StackTrace);
}
msg.Position = msgPosition + msgLength * 8;
}
@@ -203,7 +203,7 @@ namespace Barotrauma
if (GameSettings.SendUserStatistics)
{
CrashMessageBox( "A crash report (\"crashreport.log\") was saved in the root folder of the game and sent to the developers.");
GameAnalytics.AddErrorEvent(EGAErrorSeverity.Error, crashReport);
GameAnalytics.AddErrorEvent(EGAErrorSeverity.Critical, crashReport);
GameAnalytics.OnStop();
}
else
@@ -737,8 +737,20 @@ namespace Barotrauma
//hash will be null if opening the sub file failed -> don't select the sub
if (string.IsNullOrWhiteSpace(hash))
{
(component as GUITextBlock).TextColor = Color.DarkRed * 0.8f;
component.CanBeFocused = false;
if (component is GUITextBlock textBlock)
{
textBlock.TextColor = Color.DarkRed * 0.8f;
textBlock.CanBeFocused = false;
}
else
{
DebugConsole.ThrowError("Failed to select submarine. Selected GUIComponent was of the type \"" + (component == null ? "null" : component.GetType().ToString()) + "\".");
GameAnalyticsManager.AddErrorEventOnce(
"NetLobbyScreen.SelectSub:InvalidComponent",
GameAnalyticsSDK.Net.EGAErrorSeverity.Error,
"Failed to select submarine. Selected GUIComponent was of the type \"" + (component == null ? "null" : component.GetType().ToString()) + "\".");
}
StartButton.Enabled = false;
@@ -55,6 +55,10 @@ namespace Barotrauma.Sounds
#else
DebugConsole.NewMessage("OpenAL error: " + AL.GetErrorString(error) + "\n" + Environment.StackTrace, Microsoft.Xna.Framework.Color.Red);
#endif
GameAnalyticsManager.AddErrorEventOnce(
"OggStream.Check:"+ AL.GetErrorString(error),
GameAnalyticsSDK.Net.EGAErrorSeverity.Error,
"OpenAL error: " + AL.GetErrorString(error) + "\n" + Environment.StackTrace);
}
}
}