The error information stored in FirstError is not the last error that occurred, but the last error at the time OnError was triggered. Is this a specification? Is it a bug?
I'm checking the behavior of OnError and FirstError / AllErrors when multiple OnError are executed simultaneously.
The following methods are used to check.
(1) Store the contents of FirstError at this point in a variable.
Set(AppCatchedErr,FirstError);
(2) Insert the following contents at this point into the collection (ErrorCollection)
AppCatchedErr,FirstError,First(AllErrors)
(3) Time-consuming process. (This is intended to create a time difference between (2) and (4).
This is achieved by Refresh() on multiple tables
(4) Insert the following contents at this point into the collection (ErrorCollection)
AppCatchedErr,FirstError,First(AllErrors)
This should cause OnError to be executed five times when the button is pressed.The results are as follows
These indicate the following behavior at this time.
Is this a specification?
Or is it a bug where the FirstError / AllErrors value is fixed within the OnError process?
Since it is quite common for an OnError to be triggered multiple times from a single action, I am concerned that if this is a bug rather than a specification, OnError will not have the effect I am hoping for.
The version is 3.22021.27.
The following article is a reference, but I could not confirm about the actual specification.
3.21122: Filter behavior change with errors - Power Platform Community (microsoft.com)
IfError, IsError, and IsBlankOrError functions in Power Apps - Power Apps | Microsoft Docs
Thank you in advance for your answer.
PS
This posting is made using DeepL.
If there is something wrong with my grammar that you don't understand, I would appreciate a reply.
Solved! Go to Solution.
Hello @Fuku-Shima thank you for your post. You are correct, the specification of App.OnError is that it will be triggered for all instances of errors that are not handled - not for an action that may have caused that error - and it can happen concurrently. If you store the error in a variable, and try to access it later in the same App.OnError expression, it is possible that other instances of App.OnError would have overwritten it.
Hope this helps. If not, can you provide more details of your scenario?
Hello @Fuku-Shima thank you for your post. You are correct, the specification of App.OnError is that it will be triggered for all instances of errors that are not handled - not for an action that may have caused that error - and it can happen concurrently. If you store the error in a variable, and try to access it later in the same App.OnError expression, it is possible that other instances of App.OnError would have overwritten it.
Hope this helps. If not, can you provide more details of your scenario?
Hello CarlosFigueira . Thanks for the reply.
I am relieved to know that it is not a bug but a specification.
The spec is exactly what I would expect regarding FirstError within OnError.
Resolved. Thank you .
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.