-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat: Add error callback #413
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
Found a JIRA ticket from the last time this was encountered https://amplitude.atlassian.net/browse/AMP-35348 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, 1 small nit
@@ -1468,6 +1525,28 @@ if (BUILD_COMPAT_2_0) { | |||
}; | |||
} | |||
|
|||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: since logErrorsOnEvents
is private, should it be _logErrorsOnEvents
for convention?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point, lemme fix that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jooohhn done
# [8.4.0](v8.3.1...v8.4.0) (2021-07-30) ### Features * Add error callback ([#413](#413)) ([c50429d](c50429d))
Still having the same issueHey there! Today I installed amplitude-js 8.16.0, and it's not working when uBlock is turned on. When I switch it off, it works just fine. Any idea how to solve this? Thanks! |
Hi @gigiRa, this fix allows developers to detect when the JS SDK is blocked by uBlock or other blocker extensions, but it cannot bypass the extensions by itself. If you're looking for a way to work around a blocking extension, one solution Amplitude recommends is to set up a proxy on your own servers https://developers.amplitude.com/docs/domain-proxies |
Summary
Adds an error callback to the various event logging methods
The tricky part to this is that the existing callback has very specific behavior not to be called when there's an error, except in the case where the error is with the state of the sdk client. In order to not break that behavior, I did the following
Checklist
https://amplitude.atlassian.net/browse/AMP-35348