Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to include properties for any exception/error reported #242

Closed
supersolid-corentin opened this issue Jan 25, 2019 · 3 comments
Closed

Comments

@supersolid-corentin
Copy link

supersolid-corentin commented Jan 25, 2019

This is a feature that is really important to be able to handle some tricky bugs. Sometimes the stacktrace is not enough to fix the issue or the stacktrace is really too short like the ones that are sent by release builds when using IL2CPP. Having some context about the state of the game at the time of the crash is always useful in those cases. Would it be possible to implement a callback or an event that is called just before the exception/error is tracked? I implemented it that way in my project:

Crashes.cs

public static event Action<IDictionary<string, string>> AddCrashMetadataEvent;

private static void TrackErrorInternal(WrapperException exceptionWrapper)
{
	Dictionary<string, string> properties = new Dictionary<string, string>();
	if (AddCrashMetadataEvent != null)
	{
		AddCrashMetadataEvent(properties);
	}
	if (properties == null || properties.Count == 0)
	{
		CrashesInternal.TrackException(exceptionWrapper.GetRawObject());
	}
	else
	{
		CrashesInternal.TrackException(exceptionWrapper.GetRawObject(), properties);
	}
}

And I replaced the calls to CrashesInternal.TrackException() in that file by calls to TrackErrorInternal.

Game.cs

void Start()
{
        Crashes.AddCrashMetadataEvent += OnCrash;
}

private void OnCrash(IDictionary<string, string> properties)
{
        properties.Add("matchId", matchId);
        ....
}

It works fine for my use but maybe there's a better way to integrate it into the SDK. Thanks in advance for the feedback!

@maestersid
Copy link

maestersid commented Jan 25, 2019

Hello! Thank you for bringing this up. I checked with the engineering team and it does not look like we offer a native way to record this information during a crash at this point so your solution may work for now. It is excellent feedback however and I have passed it onto the team to look into.

@supersolid-corentin
Copy link
Author

Thanks again for the quick reply. That will be really helpful to update the SDK later on and to include it in other projects as well.

@DmitriyKirakosyan
Copy link
Contributor

As we do not have plans to add support for this feature in the next year, I'm closing the issue.

@DmitriyKirakosyan DmitriyKirakosyan closed this as not planned Won't fix, can't repro, duplicate, stale Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants