I see this error a bunch in javascript that I’m debugging. In the JS console Chrome says something very similar to
TypeError
arguments: Array[2]
message: "-"
stack: "-"
type: "non_object_property_load"
__proto__: Error
I can usually work my way to the underlying problem, but in general what does the error represent?
Is there any way to get a stack trace to the line that caused the problem?
You’re trying to access something from
nullorundefined.For example, this code will throw such an error:
You should check which properties you’re accessing from which objects, and use something like
obj && obj.propinstead of justobj.prop.You can get the stack trace using:
The
-means the property is a getter, and is not displayed automatically because a getter can have side effects. The stack is available though (the-does not mean “not available”); you just have to access it explicitly.