Help with understanding *errors* as they are shown

This is a question in the broader sense that I am confused by WHAT is shown rather than the specifics of the error itself.

A couple of days back I got this error:
{"message":"TypeError: msg.payload.sort is not a function","source":{"id":"90fd90b2.99848","type":"function","name":"Native JS Sort","count":1}}

And the part that got me was/is this part:

TypeError: msg.payload.sort is not a function

Now I am confused because in the bigger scheme of things the node worked/works and I just stuffed up the use of that node.

To me HOW I was told is misleading.
The words are very clear to me - but I'm illiterate.
msg.payload.sort is not a function.

But it is! Or it wouldn't be written like that.

How have I got the bull by the horns?
I'm asking because I fear this is causing me a lot of grief for no real reason other than I don't believe it, and so am wasting time looking in the wrong places when tracking down errors.

msg.payload.sort is not a function .

If you inject values that it cannot "function on", you will get this error.

human.fly() is not a function

Ok.... But @Steve-Mcl made a simple subflow he posted for me to use on a project.

It works.

I used the flow works as he showed it and I tested it in it's demonstration flow.
It worked.

I stuffed up and didn't use/include a function node upstream in the example he gave me.
So that node not being in the flow I .. used.... it threw an error.
This is his flow.

You mentioned you didn't understand what it meant, rather than your specific example.

Here is the explanation in general terms TypeError: "x" is not a function - JavaScript | MDN

I'm shooting myself in the foot by saying it, but that looks complicated.

However it seems counter intuitive how the errors are reported.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.