In Screen.OnVisible, I make a ClearConnect call against a Power Automate flow that is connected to my app, like:
ClearCollect(queryResults,'FlowName'.Run(parameter1));
which returns an array of JSON objects. (As a result, the Flow's last step is a Response object rather than a Respond to a PowerApp object.) The flow in turn queries other data sources and, as a result, the flow can fail.
If the flow fails for any reason, I want to notify the user, explain the type of error, and also make some changes to the appearance of the app, such disabling or hiding certain elements.
It's not clear how I can do this. In the flow I can either return a success code (200 code) and an error message in the body or I can return a failure code (500) along with an error message, then the app can consume and display the message. Returning 500 seems like a better approach.
When I return a 500 code along with a JSON object with an error message, this Error notification occurs:
FlowName.Run failed: { "error": { "code": 502, "source": "msmanaged-na.azure-apim.net", "clientRequestId": "xxxxxxxx-c58a-4cb0-b52e-f731c44386a6", "message": "BadGateway", "innerError": { "error": "Custom error message in flow." } } }
I did not build in this notification, the app is showing it on its own, I believe.
The app recognizes that an error occurred and does display the message returned from the flow along with other information. But this is not user friendly or actionable.
How can I handle this error from a ClearCollect cleaning, make other changes to my app as a result and display the custom error message?

Report
All responses (
Answers (