cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AIUYM19
Advocate V
Advocate V

How to read response headers from Power Automate

In my app, I have a screen with the following value in the OnVisible property.

UpdateContext({Loading: true, ErrorNotification: false});
Clear(Manifest);
IfError(
    Collect(Manifest, PowerAutomateFlow.Run(SelectedProgram.Name).Items),
    UpdateContext({ErrorNotification: true, ErrorCode: "B1"});
        Clear(Manifest)
);
UpdateContext({Loading: false})

When this runs, the response from PowerAutomateFlow.Run() will be either 200 (containing an Items array) or 502 (containing a custom error object). If the response is 200, I want to perform one action; if it's 502, I want to perform another.

 

When 200 is returned, this code works. However, when 502 is returned, PowerApps simply throws an error at PowerAutomateFlow.Run() and doesn't perform the error actions. What am I doing wrong?

4 REPLIES 4
AIUYM19
Advocate V
Advocate V

Anyone?

 

...Bueller? ...Bueller?

alrez
Community Support
Community Support

Hi,

 

Looking through the code itself, it looks fine to me. I would guess that there is some kind of other issue going on in the PowerApp that is indirectly causing this issue. Without delving more into this its difficult to say for certain. I would probably recommend opening a ticket with Microsoft Support on this. I'll include a link below if you would like to go down that path. Otherwise if any other communities members have any ideas feel free to chime in.

 

If you would like to create a ticket with Microsoft Customer Support here is a link on how to do so: https://docs.microsoft.com/en-us/power-platform/admin/get-help-support

 

Regards,

 

Alex

 

-------

 

Community Support Team _ Alex Rezac
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi, @alrez.

 

I think there is a special process I need to follow through my organization if I need to get in touch with Microsoft Support. So, I will open a ticket with my Service Desk to start that process.

 

In the meantime, is there a better method I could be using in PowerApps for error handling? In Java, Visual Basic, and JavaScript (my three most-used languages), all three have some form of a

try {
    ...
} catch(Exception e) {
    ...
}

clause that I can use. Is

IfError(
    [try clause],
    [catch clause]
)

the only form of structured error handling in PowerApps?

Here is a screenshot of the error thrown by PowerApps. When this occurs, I want the actions in the second argument of my IfError() clause to be performed. However, PowerApps stops processing my code immediately upon throwing that error.

Screenshot 2021-03-16 153116.jpg

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,415)