Skip to content

Commit

Permalink
Added error catching for the underlying FTP lib.
Browse files Browse the repository at this point in the history
  • Loading branch information
teastman committed Oct 27, 2017
1 parent 71fce6d commit aec2936
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ftp-download.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</div>
<div class="form-row">
<label for="node-config-input-name"><i class="fa fa-tag"></i> <span data-i18n="server.name"></span></label>
<input type="text" id="node-input-name">
<input type="text" id="node-config-input-name">
</div>
</script>

Expand Down
13 changes: 12 additions & 1 deletion ftp-download.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,18 @@ module.exports = function (RED) {
});
}

conn.connect(node.serverConfig.options);
conn.on('error', (err) => {
msg.payload = err;
node.error("An error occurred with the FTP library.", msg);
});

try{
conn.connect(node.serverConfig.options);
}
catch (err) {
msg.payload = err;
node.error("Could not connect to the FTP server.", msg);
}
});

node.on('close', () => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-red-contrib-ftp-download",
"version": "1.0.3",
"version": "1.0.4",
"description": "A Node-RED node for FTP downloading.",
"dependencies": {
"ftp": "0.x"
Expand Down

0 comments on commit aec2936

Please sign in to comment.