mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add option to only send http response errors to Catch node
This commit is contained in:
parent
1419729458
commit
3759e0f778
@ -86,6 +86,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
<input type="checkbox" id="node-input-senderr" style="display: inline-block; width: auto; vertical-align: top;">
|
||||||
|
<label for="node-input-senderr" style="width: auto" data-i18n="httpin.senderr"></label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-ret"><i class="fa fa-arrow-left"></i> <span data-i18n="httpin.label.return"></span></label>
|
<label for="node-input-ret"><i class="fa fa-arrow-left"></i> <span data-i18n="httpin.label.return"></span></label>
|
||||||
<select type="text" id="node-input-ret" style="width:70%;">
|
<select type="text" id="node-input-ret" style="width:70%;">
|
||||||
@ -114,7 +120,8 @@
|
|||||||
tls: {type:"tls-config",required: false},
|
tls: {type:"tls-config",required: false},
|
||||||
persist: {value:false},
|
persist: {value:false},
|
||||||
proxy: {type:"http proxy",required: false},
|
proxy: {type:"http proxy",required: false},
|
||||||
authType: {value: ""}
|
authType: {value: ""},
|
||||||
|
senderr: {value: false}
|
||||||
},
|
},
|
||||||
credentials: {
|
credentials: {
|
||||||
user: {type:"text"},
|
user: {type:"text"},
|
||||||
|
@ -72,6 +72,7 @@ in your Node-RED user directory (${RED.settings.userDir}).
|
|||||||
var paytoqs = false;
|
var paytoqs = false;
|
||||||
var paytobody = false;
|
var paytobody = false;
|
||||||
var redirectList = [];
|
var redirectList = [];
|
||||||
|
var sendErrorsToCatch = n.senderr;
|
||||||
|
|
||||||
var nodeHTTPPersistent = n["persist"];
|
var nodeHTTPPersistent = n["persist"];
|
||||||
if (n.tls) {
|
if (n.tls) {
|
||||||
@ -537,10 +538,16 @@ in your Node-RED user directory (${RED.settings.userDir}).
|
|||||||
nodeSend(msg);
|
nodeSend(msg);
|
||||||
nodeDone();
|
nodeDone();
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
if(err.code === 'ETIMEDOUT' || err.code === 'ESOCKETTIMEDOUT') {
|
// Pre 2.1, any errors would be sent to both Catch node and sent on as normal.
|
||||||
|
// This is not ideal but is the legacy behaviour of the node.
|
||||||
|
// 2.1 adds the 'senderr' option, if set to true, will *only* send errors
|
||||||
|
// to Catch nodes. If false, it still does both behaviours.
|
||||||
|
// TODO: 3.0 - make it one or the other.
|
||||||
|
|
||||||
|
if (err.code === 'ETIMEDOUT' || err.code === 'ESOCKETTIMEDOUT') {
|
||||||
node.error(RED._("common.notification.errors.no-response"), msg);
|
node.error(RED._("common.notification.errors.no-response"), msg);
|
||||||
node.status({fill:"red", shape:"ring", text:"common.notification.errors.no-response"});
|
node.status({fill:"red", shape:"ring", text:"common.notification.errors.no-response"});
|
||||||
}else{
|
} else {
|
||||||
node.error(err,msg);
|
node.error(err,msg);
|
||||||
node.status({fill:"red", shape:"ring", text:err.code});
|
node.status({fill:"red", shape:"ring", text:err.code});
|
||||||
}
|
}
|
||||||
@ -549,7 +556,9 @@ in your Node-RED user directory (${RED.settings.userDir}).
|
|||||||
if (node.metric() && timingLog) {
|
if (node.metric() && timingLog) {
|
||||||
emitTimingMetricLog(err.timings, msg);
|
emitTimingMetricLog(err.timings, msg);
|
||||||
}
|
}
|
||||||
nodeSend(msg);
|
if (!sendErrorsToCatch) {
|
||||||
|
nodeSend(msg);
|
||||||
|
}
|
||||||
nodeDone();
|
nodeDone();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -486,6 +486,7 @@
|
|||||||
"proxy-config": "Proxy Configuration",
|
"proxy-config": "Proxy Configuration",
|
||||||
"use-proxyauth": "Use proxy authentication",
|
"use-proxyauth": "Use proxy authentication",
|
||||||
"noproxy-hosts": "Ignore hosts",
|
"noproxy-hosts": "Ignore hosts",
|
||||||
|
"senderr": "Only send non-2xx responses to Catch node",
|
||||||
"utf8": "a UTF-8 string",
|
"utf8": "a UTF-8 string",
|
||||||
"binary": "a binary buffer",
|
"binary": "a binary buffer",
|
||||||
"json": "a parsed JSON object",
|
"json": "a parsed JSON object",
|
||||||
|
Loading…
Reference in New Issue
Block a user