Error Handling and Log Management in Canvas Apps - Part 3
Unhandled Errors to Application Insights Test
This is the last post in this series: Error Handling and Log Management in Canvas Apps
Previously, we already explored ways to manage errors and log events but some errors can still happen without our notice.
We must also prepare for this kind of occurrence.
It could be due to one of the following:
A data source is changed.
Network outages
Inadequate permissions
Edit conflicts.
There are two basic steps to get this done:
Enable error passing to Application Insights
View the errors in Application Insights
Enable error passing to Application Insights
To do this we must access the settings of our canvas app
Click on settings
Navigate to Upcoming Features
Navigate to the Experimental Tab
Scroll down till you find the toggle: Pass errors to Azure Application Insights
Enable this feature.
Now save and publish the app.
Play the app from the list of apps
Perform some actions that can lead to errors such as any of the ones listed above.
View the errors in Application Insights
Log in to the Azure Portal and navigate to the Application Insights resource
Select Logs under Monitoring from the left navigation pane:
Type the following query to filter for unhandled errors:
traces | where message == "Unhandled error" | order by timestamp
That’s all we need to do.
Additional notes from Microsoft:
Unhandled Power Fx errors experienced by end users at app runtime will be reported to the traces table. Unhandled errors can be identified and distinguished from other error events by the event message "Unhandled error". The "severityLevel" dimension of these events will be 3 (TraceSeverity.Error).Detailed error messages are provided in the "errors" dimension of the customDimension property. In situations where multiple errors occurred during the same operation, these errors will be consolidated in the "errors" dimension of a single trace event. These error messages are the same as reported in Monitor during a live debug session.
Thank you for following this series.
In my next post, we will explore more integration features.