The best approach is generally using On block error to handle blocks of actions or entire subflows, and also having a subflow that the block calls on error, to log the error. The subflow should then contain Get last error to get the error and then your preferred logging mechanism (such as Write text to file or Write to CSV file or whatever) to log the error somewhere.
That's the basics. A more advanced framework is also possible, but quite difficult to explain in a reply here.
-------------------------------------------------------------------------
If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.
I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.