Error handling in chained behaviour functions - the default behaviour is inappropriate
Quoting the documentation:
In a chained behavior formula, actions don't stop after the first error.
This means that this example will continue and close the app even if the patch fails:
Patch(...);
Exit();
We can prevent this by using IfError:
IfError(
Patch(...),
AllErrors, //Makes the error(s) be returned as result of IfError and no more is executed below
Exit()
)
This default behaviour means that in a robust Power Apps application, every behaviour function that uses chaining (;) needs to use IfError. Without it, in this example the app closes having lost the data the user entered. In other cases it could continue to patch and take other actions that are destructive/incorrect.
For this reason, continuing on error is IMO both dangerous and confusing for beginners!
In other languages, this is reversed. The default is that execution will stop and look for the nearest exception/error handler in the stack. In these languages, we only have to put in error handling if there's something we want to do instead of this default "stop" behaviour.
I feel that PowerFX should move to this as a default too. In my experience there are less cases where you don't want to stop when an error occurs than places where you do. Stopping when one of the formulas in the chained formula results in an error should be the default and the user can add the existing IfError around any expressions where they do want to handle this differently. This gives an easy to understand and robust default.
Robust applications are currently filled with IfError and other error handling. Changing the default would really clean this up and increase the quality of application made with Power Apps.