How to handle a `AppIntent.perform()` error in Widget?

Hello.

My project includes a widget target that provides interactive widget functionalities. The document "Adding Interactivity to Widgets and Live Activities" says the following:

Additionally, note that the perform() function is marked as throws. Be sure to handle errors instead of rethrowing them, and update your app, widget, and Live Activity as needed. For example, update a widget’s interface to indicate that it displays outdated information if it cannot load new data.

https://developer.apple.com/documentation/widgetkit/adding-interactivity-to-widgets-and-live-activities#Implement-the-perform-function, column 3

However, I couldn't find a way how to handle an error in an interactive widget. The Button(intent:) and Toggle(intent:) initializers don't have mechanisms for error handling.

Does anyone know a solution for handling errors in interactive widgets?

Did you find a solution? My best solution so far was to store an error flag in the user defaults shared between my app and widgets and in the timeline provider return an entry that shows an error, and within that UI have another Intent that 'resets' the error flag and lets it reload.

How to handle a `AppIntent.perform()` error in Widget?
 
 
Q