Get Data to Var... but nothing work

hi!
i have a catch node.
on this node is a debug node.
the return on the debug node is:

14.4.2023, 19:00:30node: debug 43
msg : Object
object
error: object
message: "no JSON"
source: object
value: undefined
_error: "Error: no JSON"
_msgid: "f8b6616adb8c44bc"

on the same catch node is a Function node. I want to read the error with the follow script:

var erroreins = msg.payload.error.message;
if (erroreins == "no JSON") {
    return [
        { payload: 'restart' },

    ]
}

but it do not work....
I copy the path with the "Copy Path" function.
If i get a Error the Function do not work.....
Why?

here is a link to the debug message....

I see no mention of payload in the debug output, hmm? I do see msg error and message.
Have you tried using the copy path button that appears when you hover the cursor over message property name in the debug panel?

sorry ... i can't reproduce it now... i need some time to reproduce it....
i hope i need one of two hours (but i have use the copy path button behind the message)

ok here the next picture with copy path.....

After click i got the follow:
error.message
i think everytime is it a msg.payload? so i think its right:
msg.payload.error.message
???

It is always msg when it enters or outputs a function node, after that you can use any property name you wish. Using copy path you should always add msg when using it in a function node.

As this is an error it is sent in msg.error, as payload is probably carrying other data.

THANK YOU,
! NOW IT RUN!
Thank you very much!

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