How to Catch "msg : error"?

Hello,
I have establish communication between my PLC (Eaton E4) and an OPCUA Server. I think everything works fine. But in case of losing conncection to my PLC my console gives me "msg : error", I tried to catch it with catch node - but it does not work. I am new to Node-Red and I don't have an idea what to do now.

I hope you can help me. Thank you :slight_smile:

Here is a minimal example:

[
    {
        "id": "8ed0d7b629d5bc0e",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": ""
    },
    {
        "id": "90515af6a98ac6d9",
        "type": "easyE4 COM",
        "z": "8ed0d7b629d5bc0e",
        "name": "Easy_1",
        "deviceId": "123",
        "ip": "192.168.1.117",
        "baseAuthPass": "peter",
        "authScheme": "Basic",
        "protocol": "http",
        "baseAuthUser": "peter",
        "cycleTime": "500",
        "x": 440,
        "y": 160,
        "wires": [
            [
                "f1f9d46a6fd3329f"
            ]
        ]
    },
    {
        "id": "77100a53f2650f29",
        "type": "easyE4 IN",
        "z": "8ed0d7b629d5bc0e",
        "name": "",
        "deviceId": "123",
        "selectOpList": [
            {
                "type": "0",
                "index": "1,8"
            },
            {
                "type": "7",
                "index": "104"
            },
            {
                "type": "1",
                "index": "1,8"
            },
            {
                "type": "8",
                "index": "100"
            },
            {
                "type": "8",
                "index": "102"
            },
            {
                "type": "5",
                "index": "17,32"
            }
        ],
        "sysinfo": [
            "All"
        ],
        "fb": "",
        "indexRange": "",
        "x": 430,
        "y": 220,
        "wires": [
            [
                "56b90cd73e613f91"
            ]
        ]
    },
    {
        "id": "e7ada31a502a8f96",
        "type": "catch",
        "z": "8ed0d7b629d5bc0e",
        "name": "",
        "scope": [
            "77100a53f2650f29"
        ],
        "uncaught": false,
        "x": 190,
        "y": 280,
        "wires": [
            [
                "f1fef18d2c301a2d",
                "06da0c62815f7c8a"
            ]
        ]
    },
    {
        "id": "56b90cd73e613f91",
        "type": "debug",
        "z": "8ed0d7b629d5bc0e",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 650,
        "y": 220,
        "wires": []
    },
    {
        "id": "662320bb37425612",
        "type": "inject",
        "z": "8ed0d7b629d5bc0e",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payloadType": "date",
        "x": 210,
        "y": 160,
        "wires": [
            [
                "90515af6a98ac6d9"
            ]
        ]
    },
    {
        "id": "f1f9d46a6fd3329f",
        "type": "debug",
        "z": "8ed0d7b629d5bc0e",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 650,
        "y": 160,
        "wires": []
    },
    {
        "id": "f1fef18d2c301a2d",
        "type": "debug",
        "z": "8ed0d7b629d5bc0e",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "error.message",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 670,
        "y": 280,
        "wires": []
    },
    {
        "id": "06da0c62815f7c8a",
        "type": "template",
        "z": "8ed0d7b629d5bc0e",
        "name": "",
        "field": "payload",
        "fieldType": "msg",
        "format": "handlebars",
        "syntax": "mustache",
        "template": "No conncection to device!",
        "output": "str",
        "x": 440,
        "y": 340,
        "wires": [
            [
                "417c378bc99783f2"
            ]
        ]
    },
    {
        "id": "417c378bc99783f2",
        "type": "debug",
        "z": "8ed0d7b629d5bc0e",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 650,
        "y": 340,
        "wires": []
    }
]

Hi,
Give it a try with the status node, maybe it will show the connection status.
Hard to try here if you don't have the plc.

I tried that too, with msg.status.text but I don't get an output..

Hmm.. I think not, because the error is for no connection to plc, so it would work without it.. :smiley:

Thank you for the answer. :slight_smile:

The easyE4 COM: node is always saying that's connected. Even if I don't have the plc and the used ipaddress is not existing.
Looks a bug to me in this node and you have to contact the author.

1 Like

Yeah I noticed that too and did that already. The easyE4 IN node works and shows the correct connection state.