P
P
Pavel2016-10-19 12:28:53
JavaScript
Pavel, 2016-10-19 12:28:53

Illegal invocation gets out for some users stably, how to debug?

IllegalInvocation error pops up on line 371 of Backbone.js when trying to reset() a collection.
The funny thing is that the problem gets out on 2-3 computers. There is the same chrome, everything is fine (connected via TeamViewer), but there is an error.
The error comes out on the call() or apply() method here: backbonejs.org/docs/backbone.html#section-48

case 3: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2, a3); return;

We cannot catch the error in ourselves.
There are two questions:
1. How can this be when it works for someone and not for someone, despite the fact that they have the latest version of Chrome, and they have tried different browsers.
2. How to debug this? And how to catch, especially when the problem ends up in the library?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2016-10-19
@alexey-m-ukolov

How can this be when it works for some and not for others?
In addition to the code, there is also data that is different for everyone and browser extensions, which are generally hellish hell. The same code can work fine with some data and fall on others. A simple example is a function to divide two numbers into which 0 is passed as a divisor.
How to debug this?
Debugger.
And how to catch
The answer to this question depends on what you learn in the process of debugging. From the cause of the error, in other words.
Is the problem in the library?
The library is called by your code and with a probability of 99% the problem is in it. The fact that an "error comes out" at the Backbone level does not mean at all that it originates there. This library is many years old, it is used on thousands of projects, and if there was some serious bug, it would most likely have been caught by now.
The First Rule of Programming: It's Always Your Fault

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question