How Can I Catch Error "serial port /dev/rfcomm0 closed unexpectedly"

Hello,
(raspberry pi 2b, node-red v0.19.5)
I have a battery operated bluetooth thermometer (testing wine temperature) that I do not use very often... (or too often, I don't know). I switch it off when I do not need it to preserve the battery. But when I do I get the "serial port /dev/rfcomm0 closed unexpectedly" error (every 10-15 seconds or so) in my debug window. I would like to get rid of this, since I know the port is closed, it clutters my debugging windows.

Once, I get this repeated message, the node seems to try to reconnect and gives invalid status toggling from node-red:common.status.not-connected to node-red:common.status.connected. (as a bonus). Therefore, I cannot use the status to release the device.

I tried to catch the error with the "Catch node" without much success. (

If I could catch the error I could just automatically release the /dev/rfcomm0 .. then I would get only one message, (File not found)...
I try to include the flow, but most of it does not apply to the problem... Only the Serial node is of the matter.
How can I catch the error : "serial port /dev/rfcomm0 closed unexpectedly" ??
thanks

    {
        "id": "dd0b96ba.ca1d08",
        "type": "serial in",
        "z": "41acd98a.5798c8",
        "name": "Thermo",
        "serial": "6710935.2e06d6c",
        "x": 160,
        "y": 120,
        "wires": [
            [
                "c4dde817.7769a8"
            ]
        ]
    },
    {
        "id": "c4dde817.7769a8",
        "type": "function",
        "z": "41acd98a.5798c8",
        "name": "Temperature",
        "func": "message1 = {};\nmessage2 = {};\nmessage3 = msg.payload.port\n\n\nmsg.string = msg.payload.split(\" \");\n\nmessage1.payload=msg.string[0];\n\nmessage2.payload=msg.string[2];\n\n\n\n return [message1,message2,message3];// celsius, fahreigh, port\n",
        "outputs": 3,
        "noerr": 0,
        "x": 350,
        "y": 220,
        "wires": [
            [
                "492de263.bde9bc"
            ],
            [
                "3b8afbff.0cbbc4"
            ],
            [
                "9d589ba8.2d7c38"
            ]
        ]
    },
    {
        "id": "492de263.bde9bc",
        "type": "ui_gauge",
        "z": "41acd98a.5798c8",
        "name": "",
        "group": "593a5a67.b54d74",
        "order": 2,
        "width": "6",
        "height": "6",
        "gtype": "gage",
        "title": "Température °C",
        "label": "C",
        "format": "{{value | number:1 }} °C",
        "min": "-40",
        "max": "100",
        "colors": [
            "#0000ff",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "",
        "seg2": "",
        "x": 560,
        "y": 160,
        "wires": []
    },
    {
        "id": "9d589ba8.2d7c38",
        "type": "debug",
        "z": "41acd98a.5798c8",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "x": 550,
        "y": 280,
        "wires": []
    },
    {
        "id": "3b8afbff.0cbbc4",
        "type": "ui_gauge",
        "z": "41acd98a.5798c8",
        "name": "",
        "group": "593a5a67.b54d74",
        "order": 3,
        "width": "6",
        "height": "6",
        "gtype": "gage",
        "title": "Température °F",
        "label": "F",
        "format": "{{value | number:1 }} °F",
        "min": "-40",
        "max": "212",
        "colors": [
            "#0000ff",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "",
        "seg2": "",
        "x": 560,
        "y": 220,
        "wires": []
    },
    {
        "id": "88f3bc64.99aa4",
        "type": "debug",
        "z": "41acd98a.5798c8",
        "name": "catch thermo",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "x": 370,
        "y": 320,
        "wires": []
    },
    {
        "id": "6baa66f0.277508",
        "type": "function",
        "z": "41acd98a.5798c8",
        "name": "status",
        "func": "msg1={};\nmsg2={};\nmsg2.payload = msg.status.text;\nif (msg.status.text== \"node-red:common.status.not-connected\"){\nmsg1.payload = \"Débranché\";\n\n}\nif (msg.status.text== \"node-red:common.status.connected\"){\nmsg1.payload = \"Branché\";    \n}\n\n return [msg1,msg2];\n",
        "outputs": 2,
        "noerr": 0,
        "x": 370,
        "y": 580,
        "wires": [
            [
                "1b22b754.7158c9",
                "691bb477.f27a0c"
            ],
            [
                "93318ebd.7ae1d"
            ]
        ]
    },
    {
        "id": "32016656.df368a",
        "type": "status",
        "z": "41acd98a.5798c8",
        "name": "",
        "scope": [
            "dd0b96ba.ca1d08"
        ],
        "x": 180,
        "y": 580,
        "wires": [
            [
                "7ebcf248.fa907c",
                "6baa66f0.277508"
            ]
        ]
    },
    {
        "id": "1b22b754.7158c9",
        "type": "ui_text",
        "z": "41acd98a.5798c8",
        "group": "593a5a67.b54d74",
        "order": 1,
        "width": "1",
        "height": "1",
        "name": "Status Thermomètre",
        "label": "",
        "format": "{{msg.payload}}",
        "layout": "row-spread",
        "x": 580,
        "y": 640,
        "wires": []
    },
    {
        "id": "7ebcf248.fa907c",
        "type": "debug",
        "z": "41acd98a.5798c8",
        "name": "raw sta",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "x": 380,
        "y": 520,
        "wires": []
    },
    {
        "id": "691bb477.f27a0c",
        "type": "debug",
        "z": "41acd98a.5798c8",
        "name": "statusThermo",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "x": 560,
        "y": 580,
        "wires": []
    },
    {
        "id": "1aeb9fbb.6133",
        "type": "ui_button",
        "z": "41acd98a.5798c8",
        "name": "ThermoBlueToothButton",
        "group": "593a5a67.b54d74",
        "order": 2,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "{{msg.label}}",
        "tooltip": "",
        "color": "",
        "bgcolor": "{{background}}",
        "icon": "bluetooth",
        "payload": "",
        "payloadType": "str",
        "topic": "",
        "x": 690,
        "y": 440,
        "wires": [
            [
                "56b35213.9cee2c"
            ]
        ]
    },
    {
        "id": "45213299.0cf75c",
        "type": "comment",
        "z": "41acd98a.5798c8",
        "name": "force connect",
        "info": "was \nsudo rfcomm connect hci0 20:16:11:02:41:36  1",
        "x": 770,
        "y": 380,
        "wires": []
    },
    {
        "id": "56b35213.9cee2c",
        "type": "delay",
        "z": "41acd98a.5798c8",
        "name": "",
        "pauseType": "delay",
        "timeout": "500",
        "timeoutUnits": "milliseconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 930,
        "y": 440,
        "wires": [
            [
                "1aab4a13.579b36",
                "5b5aa25e.df8dbc"
            ]
        ]
    },
    {
        "id": "1aab4a13.579b36",
        "type": "exec",
        "z": "41acd98a.5798c8",
        "command": "sudo /usr/bin/rfcomm release rfcomm0",
        "addpay": false,
        "append": "",
        "useSpawn": "false",
        "timer": "",
        "oldrc": false,
        "name": "ReleaseRF",
        "x": 1130,
        "y": 440,
        "wires": [
            [
                "c3b142ba.a0411"
            ],
            [],
            []
        ]
    },
    {
        "id": "6eeca646.7a43e8",
        "type": "comment",
        "z": "41acd98a.5798c8",
        "name": "RFcomm (bluetooth) port ",
        "info": "la clef des commandes est \nsudo rfcomm bind 0 20:16:10:28:41:49 1 \nsudo rfcomm bind 2 20:16:11:02:41:36 1\nstty  -F /dev/rfcomm0 9600\nstty  -F /dev/rfcomm2 9600\n2 divan\n0 thermo\nto release\nsudo rfcomm release rfcomm0\nsudo rfcomm release rfcomm2\n\nsudo rfcomm   ' gets the status'\n",
        "x": 1170,
        "y": 380,
        "wires": []
    },
    {
        "id": "5b5aa25e.df8dbc",
        "type": "change",
        "z": "41acd98a.5798c8",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "background",
                "pt": "msg",
                "to": "ORANGE",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "label",
                "pt": "msg",
                "to": "Releasing RF",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 860,
        "y": 620,
        "wires": [
            [
                "1aeb9fbb.6133"
            ]
        ]
    },
    {
        "id": "85059361.e215d",
        "type": "change",
        "z": "41acd98a.5798c8",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "background",
                "pt": "msg",
                "to": "#3FADB5",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "label",
                "pt": "msg",
                "to": "Force Connect",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1480,
        "y": 720,
        "wires": [
            [
                "1aeb9fbb.6133"
            ]
        ]
    },
    {
        "id": "5af59b8.da5fa64",
        "type": "exec",
        "z": "41acd98a.5798c8",
        "command": "/bin/stty  -F /dev/rfcomm0 9600",
        "addpay": false,
        "append": "",
        "useSpawn": "false",
        "timer": "",
        "oldrc": false,
        "name": "Set Speed",
        "x": 1470,
        "y": 660,
        "wires": [
            [
                "85059361.e215d"
            ],
            [],
            []
        ]
    },
    {
        "id": "172f4b2f.f45405",
        "type": "delay",
        "z": "41acd98a.5798c8",
        "name": "",
        "pauseType": "delay",
        "timeout": "18",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 1460,
        "y": 580,
        "wires": [
            [
                "5af59b8.da5fa64"
            ]
        ]
    },
    {
        "id": "fea883d8.52878",
        "type": "change",
        "z": "41acd98a.5798c8",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "background",
                "pt": "msg",
                "to": "#87A980",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "label",
                "pt": "msg",
                "to": "Connecting...",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1480,
        "y": 520,
        "wires": [
            [
                "1aeb9fbb.6133",
                "172f4b2f.f45405"
            ]
        ]
    },
    {
        "id": "60287713.ff6db8",
        "type": "exec",
        "z": "41acd98a.5798c8",
        "command": "sudo rfcomm bind 0 20:16:10:28:41:49 1",
        "addpay": false,
        "append": "",
        "useSpawn": "false",
        "timer": "",
        "oldrc": false,
        "name": "Bind",
        "x": 1450,
        "y": 440,
        "wires": [
            [
                "fea883d8.52878"
            ],
            [],
            []
        ]
    },
    {
        "id": "c3b142ba.a0411",
        "type": "delay",
        "z": "41acd98a.5798c8",
        "name": "",
        "pauseType": "delay",
        "timeout": "3",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 1300,
        "y": 440,
        "wires": [
            [
                "60287713.ff6db8"
            ]
        ]
    },
    {
        "id": "5bfe43ac.0ed09c",
        "type": "catch",
        "z": "41acd98a.5798c8",
        "name": "",
        "scope": [
            "dd0b96ba.ca1d08"
        ],
        "x": 150,
        "y": 320,
        "wires": [
            [
                "88f3bc64.99aa4"
            ]
        ],
        "outputLabels": [
            "this.error"
        ]
    },
    {
        "id": "93318ebd.7ae1d",
        "type": "debug",
        "z": "41acd98a.5798c8",
        "name": "release",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "x": 460,
        "y": 700,
        "wires": []
    },
    {
        "id": "385edac7.e8e466",
        "type": "delay",
        "z": "41acd98a.5798c8",
        "name": "",
        "pauseType": "delay",
        "timeout": "4",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 1260,
        "y": 1020,
        "wires": [
            [
                "64ffe13e.b069e"
            ]
        ]
    },
    {
        "id": "4ff18b7c.45c4e4",
        "type": "exec",
        "z": "41acd98a.5798c8",
        "command": "sudo /usr/bin/rfcomm release rfcomm0",
        "addpay": false,
        "append": "",
        "useSpawn": "false",
        "timer": "",
        "oldrc": true,
        "name": "ReleaseRF",
        "x": 870,
        "y": 940,
        "wires": [
            [
                "d2962863.a1c3f8"
            ],
            [],
            [
                "d4f40c9f.3cfe2",
                "d2962863.a1c3f8"
            ]
        ]
    },
    {
        "id": "d2962863.a1c3f8",
        "type": "change",
        "z": "41acd98a.5798c8",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "background",
                "pt": "msg",
                "to": "ORANGE",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "label",
                "pt": "msg",
                "to": "Disconnecting..",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1060,
        "y": 1020,
        "wires": [
            [
                "385edac7.e8e466",
                "9f805377.b288"
            ]
        ]
    },
    {
        "id": "9f805377.b288",
        "type": "ui_button",
        "z": "41acd98a.5798c8",
        "name": "ThermoDisconnect",
        "group": "593a5a67.b54d74",
        "order": 2,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "{{msg.label}}",
        "tooltip": "",
        "color": "",
        "bgcolor": "{{background}}",
        "icon": "bluetooth",
        "payload": "",
        "payloadType": "str",
        "topic": "",
        "x": 650,
        "y": 940,
        "wires": [
            [
                "4ff18b7c.45c4e4"
            ]
        ]
    },
    {
        "id": "64ffe13e.b069e",
        "type": "change",
        "z": "41acd98a.5798c8",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "background",
                "pt": "msg",
                "to": "RED",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "label",
                "pt": "msg",
                "to": "Disconnect",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1440,
        "y": 1020,
        "wires": [
            [
                "9f805377.b288"
            ]
        ]
    },
    {
        "id": "d4f40c9f.3cfe2",
        "type": "debug",
        "z": "41acd98a.5798c8",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "x": 1060,
        "y": 960,
        "wires": []
    },
    {
        "id": "6710935.2e06d6c",
        "type": "serial-port",
        "z": "",
        "serialport": "/dev/rfcomm0",
        "serialbaud": "9600",
        "databits": "8",
        "parity": "none",
        "stopbits": "1",
        "newline": "\\n",
        "bin": "false",
        "out": "char",
        "addchar": false,
        "responsetimeout": ""
    },
    {
        "id": "593a5a67.b54d74",
        "type": "ui_group",
        "z": "",
        "name": "Thermomètre numérique",
        "tab": "2c903b25.29ec24",
        "disp": false,
        "width": "6",
        "collapse": false
    },
    {
        "id": "2c903b25.29ec24",
        "type": "ui_tab",
        "z": "",
        "name": "Thermomètre digital",
        "icon": "fa-thermometer",
        "order": 12,
        "disabled": false,
        "hidden": false
    }
]

For future reference if you select a node or nodes then use the Export feature then only the selected nodes will be exported.

Hi Colin,
thanks for your comment.
Here are only the selected nodes (I think) ....
I though being able to connect the bluetooth to the tty needed to be included...
Still : The question remains....
"How do you catch such an error in a flow so you can re-act on them ?"

    {
        "id": "dd0b96ba.ca1d08",
        "type": "serial in",
        "z": "41acd98a.5798c8",
        "name": "Thermo",
        "serial": "6710935.2e06d6c",
        "x": 160,
        "y": 120,
        "wires": [
            [
                "c4dde817.7769a8"
            ]
        ]
    },
    {
        "id": "c4dde817.7769a8",
        "type": "function",
        "z": "41acd98a.5798c8",
        "name": "Temperature",
        "func": "message1 = {};\nmessage2 = {};\nmessage3 = msg.payload.port\n\n\nmsg.string = msg.payload.split(\" \");\n\nmessage1.payload=msg.string[0];\n\nmessage2.payload=msg.string[2];\n\n\n\n return [message1,message2,message3];// celsius, fahreigh, port\n",
        "outputs": 3,
        "noerr": 0,
        "x": 350,
        "y": 220,
        "wires": [
            [
                "492de263.bde9bc"
            ],
            [
                "3b8afbff.0cbbc4"
            ],
            [
                "9d589ba8.2d7c38"
            ]
        ]
    },
    {
        "id": "492de263.bde9bc",
        "type": "ui_gauge",
        "z": "41acd98a.5798c8",
        "name": "",
        "group": "593a5a67.b54d74",
        "order": 2,
        "width": "6",
        "height": "6",
        "gtype": "gage",
        "title": "Température °C",
        "label": "C",
        "format": "{{value | number:1 }} °C",
        "min": "-40",
        "max": "100",
        "colors": [
            "#0000ff",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "",
        "seg2": "",
        "x": 560,
        "y": 160,
        "wires": []
    },
    {
        "id": "9d589ba8.2d7c38",
        "type": "debug",
        "z": "41acd98a.5798c8",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "x": 550,
        "y": 280,
        "wires": []
    },
    {
        "id": "3b8afbff.0cbbc4",
        "type": "ui_gauge",
        "z": "41acd98a.5798c8",
        "name": "",
        "group": "593a5a67.b54d74",
        "order": 3,
        "width": "6",
        "height": "6",
        "gtype": "gage",
        "title": "Température °F",
        "label": "F",
        "format": "{{value | number:1 }} °F",
        "min": "-40",
        "max": "212",
        "colors": [
            "#0000ff",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "",
        "seg2": "",
        "x": 560,
        "y": 220,
        "wires": []
    },
    {
        "id": "88f3bc64.99aa4",
        "type": "debug",
        "z": "41acd98a.5798c8",
        "name": "catch thermo",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "x": 370,
        "y": 320,
        "wires": []
    },
    {
        "id": "5bfe43ac.0ed09c",
        "type": "catch",
        "z": "41acd98a.5798c8",
        "name": "",
        "scope": [
            "dd0b96ba.ca1d08"
        ],
        "x": 150,
        "y": 320,
        "wires": [
            [
                "88f3bc64.99aa4"
            ]
        ],
        "outputLabels": [
            "this.error"
        ]
    },
    {
        "id": "32016656.df368a",
        "type": "status",
        "z": "41acd98a.5798c8",
        "name": "",
        "scope": [
            "dd0b96ba.ca1d08"
        ],
        "x": 180,
        "y": 580,
        "wires": [
            [
                "7ebcf248.fa907c",
                "6baa66f0.277508"
            ]
        ]
    },
    {
        "id": "6baa66f0.277508",
        "type": "function",
        "z": "41acd98a.5798c8",
        "name": "status",
        "func": "msg1={};\nmsg2={};\nmsg2.payload = msg.status.text;\nif (msg.status.text== \"node-red:common.status.not-connected\"){\nmsg1.payload = \"Débranché\";\n\n}\nif (msg.status.text== \"node-red:common.status.connected\"){\nmsg1.payload = \"Branché\";    \n}\n\n return [msg1,msg2];\n",
        "outputs": 2,
        "noerr": 0,
        "x": 370,
        "y": 580,
        "wires": [
            [
                "1b22b754.7158c9",
                "691bb477.f27a0c"
            ],
            [
                "93318ebd.7ae1d"
            ]
        ]
    },
    {
        "id": "7ebcf248.fa907c",
        "type": "debug",
        "z": "41acd98a.5798c8",
        "name": "raw sta",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "x": 380,
        "y": 520,
        "wires": []
    },
    {
        "id": "691bb477.f27a0c",
        "type": "debug",
        "z": "41acd98a.5798c8",
        "name": "statusThermo",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "x": 560,
        "y": 580,
        "wires": []
    },
    {
        "id": "1b22b754.7158c9",
        "type": "ui_text",
        "z": "41acd98a.5798c8",
        "group": "593a5a67.b54d74",
        "order": 1,
        "width": "1",
        "height": "1",
        "name": "Status Thermomètre",
        "label": "",
        "format": "{{msg.payload}}",
        "layout": "row-spread",
        "x": 580,
        "y": 640,
        "wires": []
    },
    {
        "id": "93318ebd.7ae1d",
        "type": "debug",
        "z": "41acd98a.5798c8",
        "name": "release",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "x": 460,
        "y": 700,
        "wires": []
    },
    {
        "id": "6710935.2e06d6c",
        "type": "serial-port",
        "z": "",
        "serialport": "/dev/rfcomm0",
        "serialbaud": "9600",
        "databits": "8",
        "parity": "none",
        "stopbits": "1",
        "newline": "\\n",
        "bin": "false",
        "out": "char",
        "addchar": false,
        "responsetimeout": ""
    },
    {
        "id": "593a5a67.b54d74",
        "type": "ui_group",
        "z": "",
        "name": "Thermomètre numérique",
        "tab": "2c903b25.29ec24",
        "disp": false,
        "width": "6",
        "collapse": false
    },
    {
        "id": "2c903b25.29ec24",
        "type": "ui_tab",
        "z": "",
        "name": "Thermomètre digital",
        "icon": "fa-thermometer",
        "order": 12,
        "disabled": false,
        "hidden": false
    }
]

Assuming that is coming from the serial node itself rather than one of your debug nodes (you should be able to see the node name above the error) then I would have expected that to be caught by a Catch node. You say you didn't have much success with a Catch node, do you mean you got nothing from it?

Or maybe the status node will catch it. (But basically you are saying it would be better if the error was only reported the first time?)

That is right. I set up the catch node to point to use only the serial node.

The error has a red vertical bar attached to it and does not refer to a node.
When the temporary bluetooth device is disconnected, the error occurs and repeats itself every 14-20 seconds. Once this error occurs, the status node changes from connected to not connected although it is not connected.
If I could catch this error message in a flow, I could then release the device. This would have the effect of stopping the invalid toggling of the status by giving only one error message (file not found).
I hope this is a bit clearer.