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

Add showErrorLog flag #160

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

takezoux2
Copy link

@takezoux2 takezoux2 commented Oct 17, 2017

Add showErrorLog flag to switch show all exception log or not.

Motivation

If useSafeMode=true, DoTween vanishes all information about exception.But it make harder to track the cause of exception while debugging.

@Demigiant
Copy link
Owner

Hi Yoshiteru,

Thanks for the contribution! I will review the code asap (will probably need a few days, sorry for that) and see about including it.

Cheers,
Daniele

@Demigiant Demigiant self-requested a review October 17, 2017 19:27
@Dentrax
Copy link

Dentrax commented Oct 22, 2017

@takezoux2

Maybe you should use in-line if statements. Like ;

if(showErrorLog) Debug.Log();

Instead of ;

if(showErrorLog){
//Codes with Log
} else {
//Same codes without Log (occurs Duplicate codes)
}

I think, duplicate codes something that is undesirable on big & complex projects. Isn't it ? :)

@takezoux2
Copy link
Author

takezoux2 commented Nov 20, 2017

@Dentrax
I fixed to DRY

I wrote not DRY code for performance, but it was wrong.
I thought there is difference between catch{}and catch(Exception e){} in performance. I measured performance by the below code, but no differences are found.

        int count = 1000000;
        {
            var start = DateTime.Now;
            for (int i = 0; i < count; i++) {
                try {
                    ThrowException();
                } catch {
                }
            }
            var end = DateTime.Now;
            Debug.Log("With catch:" + (end - start));
        }
        {
            var start = DateTime.Now;
            for (int i = 0; i < count; i++) {
                try {
                    ThrowException();
                } catch (Exception e) {
                   
                }
            }
            var end = DateTime.Now;
            Debug.Log("With catch(Exception e):" + (end - start));
        }
// Result 
With catch:00:00:03.1103550
With catch(Exception e):00:00:03.1016900

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants