This week I spent a lot of time working on an app that had offline functionality half implemented. I got the error “An Unknown Error Occurred.”, and that was all I got.
An Unknown Error Occurred
Table of Contents
Well can you get any more generic with error messages? An Unknown Error Occurred, says absolutely nothing. Unclear error messages really make development jobs difficult.
After a bit of experimenting in Power Apps I found the cause of the issue. But that doesn’t mean that it is easy to resolve. Quite quickly I found out that I was only happening when I was using the Windows Power Apps app. And more specifically I was only getting this error when I was accessing data in Dataverse while being offline.

Where to look?
This was my main challenge. Where was I going to look for the data I was accessing? My app has about 10 tables. And there is a lot of code that following this pattern:
If(Connection.connected,
LookUp(MyTable, Condition)
,
LookUp(MyCollection, Condition)
)
So I’m only accessing my table when I’m online. Whenever I’m offline I’m loading my data from a collection. This way my app will never try to access a Dataverse table.
When the error appears, it is quite obvious to look at an OnVisible property of a screen, but in my case the DisplayMode of a button had some dodgy code.
If(
LookUp(MyTable, Condition).Property = Blank()
,
DisplayMode.Edit
,
DisplayMode.Edit
)
In general many of the properties could read data from a database. If only I knew which table was read I could search through the code of my app the then find all the places where the table is used.
This now means that every time one of my screens was loading it would fail to access the Dataverse table and throw the An Unknown Error Occurred error.
Wouldn’t it be nice if the error could say: Failed to access table MyTable as you are offline. Knowing the table name will make it a lot easier to debug this issue. Especially as it isn’t possible to do any debugging in the Windows Power Apps app.
Discover more from SharePains
Subscribe to get the latest posts sent to your email.