I don't have the answer to this just yet but I just got this message under a very specific set of conditions and, interestingly enough, the different PowerApps "players" do not behave consistently.
I am working with a Flow that calls a SQL Server stored procedure that returns a set of "rows" to PowerApps as a collection. Life is good, I put in different search combos and get 1-n records back and everything functions properly. But, when I put in a perfectly valid search string combo that, perfectly validly, returns 0 records back I get two different behaviors.
So now I am off trying to learn first where this 502 error is being generated. Is it coming from the stored proc (probably not, 0 records is an acceptable response although it may return a code that indicates that 0 records match the search criteria), the Flow (probably yes but which step, in which form and where can I "receive" it from to process it) or PowerApps (if it is being passed back from the Flow somehow, how to I capture it there and address it?).
Here is what I see in the Editing area of the Studio after the error:

1) on the Web-based "player" (both within the Studio and just in the player alone), I get no errors reported to the app user.
2) on the iOS-based "player" I get the error message displayed to the user.