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 null
or undefined
.
For example, this code will throw such an error:
null.foo;
You should check which properties you're accessing from which objects, and use something like obj && obj.prop
instead of just obj.prop
.
You can get the stack trace using:
console.log(new Error().stack);
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With