Skip to content
This repository was archived by the owner on Aug 10, 2021. It is now read-only.

Conversation

@KacperKenjiLesniak
Copy link
Contributor

#28

  • Added try-catch clause to prevent breaking notification of all listeners
  • Could not run tests locally so not sure if the added test passes

@Edvinas01
Copy link
Member

Edvinas01 commented Dec 30, 2020

@KacperKenjiLesniak thank you for the PR! I'll check out the test and see if it passes - in regards to CI, I have a feeling something is broke there (unrelated to this PR).

Also sorry for the delay, it seems that I'm not getting e-mails from GitHub 🤔

Copy link
Member

@ugnelis ugnelis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done, thanks! In my opinion just 2 lines of code should be updated

}
catch (Exception e)
{
if (debug)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "debug" here is not necessary because Debug.Log is intended to work in Debug mode.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I removed it, but all other Debug.Log are surrounded with this if, so I thought I was following a convention.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I removed it, but all other Debug.Log are surrounded with this if, so I thought I was following a convention.

Its a bit confusing on how its used now. The initial idea was that those log lines would get replaced with a "stack tracer" which would allow to create an overview of how events connect with each other. Though that never came to fruition :V

{
if (debug)
{
Debug.Log($"Listener: {listener} of event: {name} has thrown an exception: {e.Message}");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend to use Debug.LogException(Exception exception, Object context) (https://docs.unity3d.com/ScriptReference/Debug.LogException.html) as not to consume the stack trace.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added Debug.LogException(Exception exception, Object context), but I also left the log informing which listener threw an exception since I think it is very useful for debugging.

@Edvinas01
Copy link
Member

In regards to failing tests, I think we can ignore them for now and once its merged, I'll run through them and see whats up.

@Edvinas01 Edvinas01 merged commit 162dd14 into chark:master Jan 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants