@5minds/node-red-contrib-processcube 1.11.0 → 1.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,6 +5,7 @@
5
5
  defaults: {
6
6
  name: { value: '' },
7
7
  error: { value: '' },
8
+ message: { value: '' },
8
9
  },
9
10
  inputs: 1,
10
11
  outputs: 1,
@@ -25,6 +26,10 @@
25
26
  <label for="node-input-error"><i class="fa fa-tag"></i> Error Code</label>
26
27
  <input type="text" id="node-input-error" placeholder="Error Code of ExternalTask" />
27
28
  </div>
29
+ <div class="form-row">
30
+ <label for="node-input-message"><i class="fa fa-tag"></i> Error Message</label>
31
+ <input type="text" id="node-input-message" placeholder="Error Message of ExternalTask" />
32
+ </div>
28
33
  </script>
29
34
 
30
35
  <script type="text/markdown" data-help-name="externaltask-error">
@@ -35,9 +40,9 @@ handling within _Error-Boundary-Events_.
35
40
  ## Inputs
36
41
 
37
42
  : msg (Object) : Passed as `ErrorDetails` to the engine
38
- : Error (string) : From the configuration oder from `msg.errorCode`
39
- : Message (string) : The caught exception message
40
- : StackTrace (string) : The stack trace of the exception
43
+ : Error (string) : From the configuration or from `msg.errorCode` or `msg.error.code`
44
+ : Message (string) : The caught exception message or `msg.errorMessage` or `msg.error.message`
45
+ : StackTrace (string) : The stack trace of the exception!
41
46
 
42
47
  ### References
43
48
 
@@ -16,17 +16,26 @@ module.exports = function (RED) {
16
16
  node.error('Error: The message did not contain the required etw_input_node_id.');
17
17
  } else {
18
18
  let msgError = msg.error;
19
-
20
- if (msgError === undefined) {
21
- msgError.message = 'An error occurred';
19
+ let errorCode = config.error;
20
+ let errorMessage = config.message;
21
+ let errorDetails = RED.util.encodeObject(msg);
22
+
23
+ if (msgError) {
24
+ if (msgError.code) {
25
+ errorCode = msgError.code;
26
+ errorMessage = msgError.message;
27
+ }
28
+ } else if (msg.errorCode) {
29
+ errorCode = msg.errorCode;
30
+ errorMessage = msg.errorMessage;
22
31
  }
23
32
 
24
- const error = new Error(msgError.message);
25
- error.errorCode = config.error || {};
26
- error.errorDetails = RED.util.encodeObject(msg);
33
+ const error = new Error(errorMessage);
34
+ error.errorCode = errorCode;
35
+ error.errorDetails = errorDetails;
27
36
 
28
- msg.errorCode = config.error;
29
- msg.errorMessage = msgError.message;
37
+ msg.errorCode = errorCode;
38
+ msg.errorMessage = errorMessage;
30
39
 
31
40
  node.log(`handle-${flowNodeInstanceId}: *flowNodeInstanceId* '${flowNodeInstanceId}' with *msg._msgid* '${msg._msgid}'`);
32
41
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-contrib-processcube",
3
- "version": "1.11.0",
3
+ "version": "1.11.1",
4
4
  "license": "MIT",
5
5
  "description": "Node-RED nodes for ProcessCube",
6
6
  "scripts": {