SempaiGames / haxe-ga

GoogleAnalytics Client API port to Haxe
Other
60 stars 23 forks source link

Enhance error handling #8

Closed delahee closed 10 years ago

delahee commented 10 years ago

We stumbled on DNS denial dued to adblockers, here is the fix for the lib to stay consistent. I you could do a haxelib release it would be super awesome.

We also added a flag to silence the lib on purpose (you can refuse this one but it is practical.

Thanks you for your awesome work.

fbricker commented 10 years ago

Hi, I see the change is valid for the flash output only. But I don't get what's the point of it? Do you really want your users to see the error trace message when they're using an AdBlock on the flash version?

vasiliy-kuznetsov commented 10 years ago

I just got exactly the same problem as delahee. This is what you would get If you have no internet connection while trying to send some stats: haxe-ga-error

Do you really want your users to see the error trace message when they're using an AdBlock on the flash version?

I suppose user won't see anything at all, since trace is protected with "silentRequest" compiler flag.

#if !silentRequest
        trace('ERROR: '+e);
#end
delahee commented 10 years ago

kickerua is right :) and without the patch there was an exception (which we do not want for user that have flash-debug) :)

fbricker commented 10 years ago

I understand, I just don't like the trace idea even if you have the "silentRequest" compiler flag, because users using haxe-ga extension will now have to know about that compiler flag when targeting flash.

I'm thinking about adding the commit without the "trace" part.

Another option is to change that part to something like this

if debug

...

end

So that developers will have to add a standard compiler flag to see the error, instead of having to add a non-standard one to avoid seeing it. What do you think?

One last question: Are you sure that the exception is avoided just by adding the IO_ERROR event lister, even if the listener function does nothing?

Thanks!

delahee commented 10 years ago

You can remove the trace, listening the event is mandatory if you dont want an exception to pop, popping an exception is not that bad except that subsequent code is skipped which will provoke some mispredictability of the app. For us game coders it is not acceptable.

Frankly I don t remember all the context that very well so I cant go much deeper in explanations ;) Le 21 juil. 2014 16:16, "fbricker" notifications@github.com a écrit :

I understand, I just don't like the trace idea even if you have the "silentRequest" compiler flag, because users using haxe-ga extension will now have to know about that compiler flag when targeting flash.

I'm thinking about adding the commit without the "trace" part.

Another option is to change that part to something like this

if debug

...

end

So that developers will have to add a standard compiler flag to see the error, instead of having to add a non-standard one to avoid seeing it. What do you think?

One last question: Are you sure that the exception is avoided just by adding the IO_ERROR event lister, even if the listener function does nothing?

Thanks!

— Reply to this email directly or view it on GitHub https://github.com/fbricker/haxe-ga/pull/8#issuecomment-49610654.

fbricker commented 10 years ago

Hi, I've added those changes and published a new version to haxelib.

Thanks for your contribution :)