Within PowerApps there is an experimental feature that could be quite useful. Time to experiment with these features.
Note that you shouldn’t use this in a production app unless you don’t mind being disturbed while you are on holiday.
Formula-level error management is one of the experimental features that could become useful. Ok, some adjustments might be needed to improve this feature, but at least it shows us a start of what might come one day.
I found that once I enabled the feature I got the following options appear:
- IfError
- Errors
IfError
IfError is a function that can help you catch problems with functions that you may run. Below you can see an example of the use of the IfError function. When the conversion of the textfield TextInput2 is failing the number -1 is returned. This could happen if the TexInput doesn’t contain a number but some text.
Note that the IfError function can only return values of a single type. This means that if you used the following to convert “test” into a date then you would need the fallback value to be set to a valid date.
IfError(DateValue(“test”),”01/01/2019″)
Errors
The Errors function returns an array of errors returned by datasource. In my example below I’ve got a form connected to my testlist in SharePoint. If you want to go further you could even specify which record you want to see the errors for.
I first created my list, then I created my form and then I adjusted the type of the field in SharePoint. I changed one of my text fields into a number field. This then resulted in an error added to the collection of Errors.
In my screen above I’m getting the error code of 8. This number actually represents an error kind. All the kinds of errors that are handled are listed below:
ErrorKind | Description |
---|---|
ErrorKind.Conflict | Another change was made to the same record, resulting in a change conflict. Use the Refresh function to reload the record and try the change again. |
ErrorKind.ConstraintViolation | One or more constraints have been violated. |
ErrorKind.CreatePermission | An attempt was made to create a record, and the current user doesn’t have permission to create records. |
ErrorKind.DeletePermission | An attempt was made to delete a record, and the current user doesn’t have permission to delete records. |
ErrorKind.EditPermission | An attempt was made to edit a record, and the current user doesn’t have permission to edit records. |
ErrorKind.GeneratedValue | An attempt was made to change a column that the data source generates automatically. |
ErrorKind.MissingRequired | The value for a required column is missing from the record. |
ErrorKind.None | There is no error. |
ErrorKind.NotFound | An attempt was made to edit or delete a record, but the record couldn’t be found. Another user may have changed the record. |
ErrorKind.ReadOnlyValue | An attempt was made to change a column that’s read only. |
ErrorKind.Sync | An error was reported by the data source. Check the Message column for more information. |
ErrorKind.Unknown | There was an error, but of an unknown kind. |
ErrorKind.Validation | There was a general validation issue detected, that did not fit one of the other kinds. |