You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Netto brought an error with the Appcues integration up to my
attention. Apparently when the script fails to load, it causes
an exception which bubbles up to the top.
I looked through the code and was pretty surprised by this, since
the Appcues integration itself is very few lines of code, and
nothing out of the ordinary.
When I dug in, I realized that this comes from an error where the
Appcues javascript fails to load for some reason.
When that happens here's the sequence of events:
- segmentio/load-script gets called, and then calls a callback
with the error
- this in turn calls .ready (in Appcues, but I think also many
other integrations)
- this emits a ready handler, which then immediately starts
flushing the message queue, causing an uncaught exception
This fix instead causes .ready when called with an error to
_not_ mark the integration as ready. Avoiding further errors.
The one thing I'm unsure of here is whether we ever end up calling
.ready() with an argument–my hunch is 'no' given that it wouldn't
do anything, but it might be worth adding an instanceof Error check.
Thoughts?
0 commit comments