The "Bad Currency Pair" error we encountered in our Currency Conversion tool is comparable to the following situation:
💡 You'd like to create a new account, but you didn't add a special character to your password - the interface is blocking you from proceeding with the account creation until you have "cleared this validation error".
How would you describe the error-handling technique that has been applied here? How could you translate this into the situation we have at hand with the "same currency error"?
(One) Solution | Theory
Instead of a cryptic system error, we want to display a nicely formatted message for the user that explains why the conversion failed and how they can fix it.
We only want to handle this specific error - not every possible failure. We are going to build a "Safety Net" specifically for the 422 DataError.
Did you come to a similar conclusion as outlined above? If yes, either try giving it a shot to implement this technique yourself or expand the section below for direct step-by-step guidance.
(One) Solution | Practice
Step-by-Step Instructions:
Add an Error Handler: Right-click the module where the crash occurs - the HTTP module - and select "Add error handler." Note: You can recognize an error-handling path by the semi-transparent dots connecting it with the originating module. Choose the Logic: We want a "beautified" response. Add another Webhook Response module to this new error-handling path. Design the Message: In the new Webhook Response module: Status: Use 422 to stay technically accurate. Body: Use a clean HTML snippet to guide the user. Sample Solution: <div style="font-family: sans-serif; padding: 10px; border: 1px solid #f5c6cb; background-color: #f8d7da; color: #721c24; border-radius: 4px;"> <strong>Selection Error:</strong> Please ensure the base and target currencies are different to perform a conversion. </div> To make sure only "Bad currency"-type errors pass through this error handling route, let's add a filter to it: Label: Only 422 Bad currency errors Condition: Use the variable Error: Detail from the HTTP module. Text Operator: Contains (case insensitive) Value: bad currency pair Save, version, deploy... you know the drill. Test the new flow: Go to your View and select EUR to EUR again.
Instead of "Computer Says No" you should now see something similar to this:
Observation
You should no longer see the cryptic error message in the View. However, take a close look at the Action Flow execution history. What do you notice?
Even though we handled our error for "bad currency pairs", the Action Flow may still be trying to process remaining modules or bundles of "good currency pairs". Think of error-handling routes like a Router - other routes are still considered as long as nothing tells the flow explicitly to stop.
The "good currency pairs" may even be processed correctly, but they never reach the surface of our View component… How could we resolve this with a different error handling strategy and design?
Rethink the current structure, then expand the hint and solution below.
(Another) Solution | Theory
The issue with our current design is that our custom error message will always be displayed as soon as at least one of the selected target currencies is invalid in the sense that it is the same as the base currency. The Action Flow still consumes API calls for the other selected, valid target currencies, but they are not displayed in the View.
The reason for that is the iterator - aggregator combination:
The Action Flow "waits" for all bundles to arrive at the aggregator module first before processing the succeeding modules, in this case, the "success" webhook response module. Since the erroneous bundle already triggers the "failure" webhook response module before the aggregator has finished collecting all bundles, the "success" webhook response has no chance of displaying anymore or "overwriting" what the other webhook response module has already sent back to the server (or in other words, to our View).
We might therefore want to look into a different approach where we only send custom error messages on the bundle level…
Think about this alternative approach described above, then check out our step-by-step guidance below on how to implement it.
(Another) Solution | Practice
To ensure your valid currency conversions are still displayed even when one fails, we need to stop "terminating" the flow on the error path. Instead, we want to provide a fallback value and let the data continue to the aggregator.
Step-by-Step Instructions:
Add a Resume Directive to the end of the error path. Set Substitutes: The Resume Directive requires fallback values for the parameters the HTTP module failed to provide. Enter the following: Status: 422 Data: Invalid - Same Currency Clear the Path: Delete the previous Webhook Response from the error path. Filter Check: Ensure the connection line still has the filter: Error: Detail contains bad currency pair. Adjust the Mapping: Your Text Aggregator will now pick up the converted value from the HTTP module (or your substitute text if an error occurred). Crucial Change: You must now map the Target Currency directly from the Iterator module (reuse the substring () formula from the HTTP module to avoid the quotation marks). Why? Because the HTTP error path doesn't provide a substitute for the currency name itself. Simplify (Optional): Since your targetValue variable is no longer needed from the "Set multiple variables" tool, you can replace it with a regular Set variable tool to keep the flow clean. Version and Deploy: Save and deploy.
The Result: Your View will now show a clean list where valid conversions (like EUR to GBP) appear normally, and the "bad" pair is clearly labeled with your substitute message.
On the following pages, we'll dive deeper into other Error Handling Directives (such as the 'Resume' directive) and their different implications on the Action Flow run and on the user experience of the "frontend" (our View).