qie.throwAckError¶
Signature: qie.throwAckError(error, resend*, emailMessage*)
Returns: void
Abort the Ack Script with an error, causing the message to be resent.
Note
Calling this method is equivalent to using the JavaScript 'throw' statement. Only call qie.throwAckError(...) from within an Ack Script.
Note
emailMessage is optional. When not specified, {error message} means any alert sent for this error uses message as its body.
Parameters¶
| Type | Name | Description | Default |
|---|---|---|---|
| String | error | error description | |
| Boolean | resend* | (optional) resend message | true |
| String | emailMessage* | (optional) an alternate message to use for the email instead of the error message in case the error contains PHI |
{error message} |
Example¶
// Ack Script on the Destination Node:
if (StringUtils.isEmpty(response)) {
return false;
}
var ackMessage = qie.parseHL7String(response);
var msgId = message.getNode('MSH-10');
var ackId = ackMessage.getNode('MSA-2');
if ((msgId.equals('') && ackId.equals('')) || !msgId.equals(ackId)) {
qie.throwAckError("Ack id (" + ackId + ") not equal to message id (" + msgId + ")");
}
if (ackMessage.getNode('MSA-1').endsWith('A')) {
return true;
} else {
qie.throwAckError("Ack Error: " + ackMessage.getNode('MSA-3'), false, "Ack Error: See channel for more information.");
}