Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Suggested answer

Detecting Specific Errors in App.Start

(1) ShareShare
ReportReport
Posted on by 245
Good Morning,
 
I have an app and I run a flow in the App.start method.
 
I want to be able to detect specific errors, not just that an error has occurred.
 
Specifically, ReponseTimeout and also when the flow is turned off.
 
I can certainly detect that an error has occurred but I cannot find code/examples for getting more specific.
 
Has anyone figure out how to do this?
 
Thanks
  • IAmIntractable Profile Picture
    245 on at
    Detecting Specific Errors in App.Start
    Was hoping a pro level person might have a solution?
  • IAmIntractable Profile Picture
    245 on at
    Detecting Specific Errors in App.Start
    Good Morning FLMike,
     
    Thank you for your response.
     
    You have made the correct distinction that the errors I am trying to detect are app generated and not from the flow. 
     
    That said, I am not clear what you are warning me not to do since I have not said anything more than wanting to detect and react to app errors thrown by a call to a flow (which seems like a ridiculous platform oversight). Can you provide some insight?
     
    You also seem to suggest that calling a flow from the App.Start is wrong. Why? I actually call the flow from app.start and do so in a way that forces the call to finish before the app.start continues to execute. I understand that this might make the app look like it's doing nothing but that is why I have a start screen and have added code to it to do nothing until the app.start is complete. The flow executes in < 1 second and this approach has worked flawlessly. Now I just want to handle some situations that have surfaced due to a recent Microsoft Platform failure. I also understand the OnError method but I am not clear (because there is no documentation) how an app processes this method and if it actually goes back to the point of error as you implied by "YOU pass back into the OnStart".
     
    I am simply looking for a code segment that might make it easy identify the app generated errors so I can react to them. There actually is a finite list of these situations that Microsoft has outlined in one of its pages. This is not an unreasonable expectation and shockingly one the platform seems to think is unnecessary.
     
    Thanks
  • Suggested answer
    Michael E. Gernaey Profile Picture
    41,385 Super User 2025 Season 1 on at
    Detecting Specific Errors in App.Start
    Hi,
     
    FIRST: Do not do what you are doing, please, please, please, please DO NOT. And now I will answer you.
     
    You are not going to always get nice specific errors. 
     
    Firstly, an error that YOU catch in the Flow, allows you to pass back the information (as long as you catch it IN the flow) to the caller, however you want.
     
    However, when an error occurs that is outside the scope of the Flow, you get back what the Platform Decides.
     
    My recommendation is to do this.
     
    1. If you do NOT add an error handler into your code, you MUST add one in the OnError of the App. Its a property like OnAppStart
     
    Any errors NOT caught, end up here, if you don't handle them here, it's the Pink Ugg of Doom Message that people get
    So you would have to look up the error codes you think you will get, handle the ones  YOU pass back into the OnStart,
    For anything you cannot handle rethrow it to the OnError
    And have codd there to do something with it.
     
    LASTLY: DO NOT DO WHAT YOU ARE DOING
     
    If you want to do what you are doing please change it to this.
     
    1. Create a Full Form Blocking Window, that is opaque (just a square)
    2. Add a Spinner (download one, buy one, build one, its all easy)
    3. Group these two things together and make sure the Spinner is on top
    4. In your OnVisible, FIRST make these 2 things Visible, with the spinner saying something like Please Wait XYZ
    5. Then call your Flow
    6. Do whatever you are going to do with the Error and App.
     
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,702 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,017 Most Valuable Professional

Leaderboard