Exception Handling on Flow Steps with Input Mapping

For DRUID version 1.68 and higher, bot authors can configure the way DRUID chatbots handle exceptions on flow steps with input mapping where DRUID validates the input data.

Exception types

DRUID addresses four types of exceptions, which are treated independently at runtime:

  • Integration Error (CNN Error) – Handles connector errors. It means that there is a PreAction or PostAction call on the Flow Step that raises the respective error.
  • Internal Action Error – There is an internal action on the flow step that throws an exception or returns false.
  • Exceeded number of input mapping attempts – The number of input attempts was reached or file uploads with text from user input has failed.
  • Uploaded file type not supported – The user uploaded a file with extension other than the supported file extentions: .pdf, .png, .jpg, .jpeg, .doc, .docx, .xls, .xlsx, .odt, .ods, .tiff, .tif, .mp3, .mp4, .mkv, .webm, .txt, .json and .csv.
  • Note:   For mobile channels (e.g., MS Teams on mobile), when uploading an image in the chat, the image extension is automatically changed to .png. In DRUID 5.18 and higher, the antimalware check allows a mismatch between the file extension .png and the following file signatures: jpg, png, jpeg, tif, tiff and bmp.
Important!  Set Variable error will NOT raise an exception; they will remain “silent” errors allowing the flow to continue its defined execution, but logging the errors in Conversation History.

How it works

On a flow step with input mapping or file upload steps, you can set the number of input attempts when Exception Handler is active. The way DRUID treats the exceptions is described below:

  1. DRUID resets the error context at the beginning of the flow step execution; it sets [[SystemError]] to null.
  2. DRUID executes the flow step by the existing rules (runs the integrations, performs data validation, NER, etc.), counts the number of iterations of the step and compare it against the defined number of input attempts set on the flow step.
  3. DRUID continues the flow execution as follows:
    • If the user provides valid input, the chatbot will either continue the flow or do intent switch.
    • When the number of input attempts is reached, DRUID stops the flow step execution at that point and proceeds to the Exception step, executing the Exceeded Attempts step that meets the specific condition.
    • In case an error occurs in the pre-actions, DRUID will raise a CNN error (executes the CNN Error step).

Important!  For flow steps with input mapping and exception handler active, when none of the Exception child steps conditions is met, DRUID will trigger the special flow ExceptionFlowId set on the bot (bot Details > Special Flows).

How to handle exceptions on flow steps with input mapping

On the desired step, go to the Metadata section, toggle on Exception handler and select the Number of attempts.

Save the step.

A new child step of type action is automatically added to the flow, with the name format “<parentStepName>_Exception” which will be executed whenever condition [[SystemError]].IsException == true is met. The step condition is also automatically set and is read-only.

Based on the types of exceptions you want to be treated at runtime, add child step(s) to the Exception step and set the specific step condition as listed in the table below:

Exception type

Step condition

Integration error (CNN Error)

[[SystemError]].ExceptionType == “ConnectorError”

Internal Action Error

[[SystemError]].ExceptionType == “InternalActionError”

Exceeded the number of input attempts

[[SystemError]].ExceptionType == “ExceededAttempts”

Uploaded file type not supported

[[SystemError]].ExceptionType == “UnsupportedFileType”

For exceptions that occur due to other reasons than the ones mentioned above. E.G., errors that occur on adaptive cards submit button.

Note:  This exception type is available in DRUID version 1.77 and higher.
[[SystemError]].ExceptionType == “OtherException”
Note:  This functionality is backwards compatible. If you have a flow step created in DRUID version prior 1.68 with input mapping and Exception Handler active and you save the step, the Exception step will be automatically added to the flow and you have to manually configure the way you want to handle one or more exception types.

Removing exceptions from flow steps with input mapping

You cannot delete the Exception step from the Flow diagram. To remove exception handling, on the step with input mapping, go to the Metadata section and tap off Exception Handler. A warning message appears. Click OK to remove the Exception step and its child steps (if any).