1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00
node-red/nodes/core/core/25-catch.html
2015-07-02 10:49:38 +01:00

63 lines
2.5 KiB
HTML

<!--
Copyright 2015 IBM Corp.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-template-name="catch">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
</div>
</script>
<script type="text/x-red" data-help-name="catch">
<p>Catch errors thrown by nodes on the same tab.</p>
<p>If a node throws a error whilst handling a message, the flow will typically
halt. This node can be used to catch those errors and handle them with a
dedicated flow.</p>
<p>The node will catch errors thrown by any node on the same tab. If there
are multiple catch nodes on a tab, they will all get triggered.</p>
<p>If an error is thrown within a subflow, the error will get handled by any
catch nodes within the subflow. If none exists, the error is propagated
up to the tab the subflow instance is on.</p>
<p>The message sent by this node will be the original message if the node that
threw the error provided it. The message will have an <code>error</code>
property with the following attributes:
<ul>
<li><code>message</code> : the error message</li>
<li><code>source.id</code> : the id of the node that threw the error</li>
<li><code>source.type</code> : the type of the node that threw the error</li>
</ul>
</p>
<p>If the message already had a <code>error</code> property, it is copied to <code>_error</code>.</p>
</script>
<script type="text/javascript">
RED.nodes.registerType('catch',{
category: 'input',
color:"#e49191",
defaults: {
name: {value:""}
},
inputs:0,
outputs:1,
icon: "alert.png",
label: function() {
return this.name||this._("catch.catch");
},
labelStyle: function() {
return this.name?"node_label_italic":"";
}
});
</script>