One example is if you are expecting an HL7 message but can get other data that you do not want to process. By default if you try to parse this as an HL7 string it would error "Unknown Segment" and put it in the error queue. However if you want it to just discard you would use a try/catch.
//try to parse a string as hl7 that is not an hl7 message. This will throw an error "Unknown segment: 'Thi'".
//We are going to catch the error and just send a debug message.
//Then we will discard the message so that is not in the error queue.
try {
var hl7 = qie.parseHL7String('This is not an hl7 message');
} catch (err) {
if (StringUtils.containsIgnoreCase(err, 'Unknown segment:')) {
qie.debug('invalid hl7 was passed to the parseHl7String');
message.discard();
}
}