PADError Handlingon-block-exitloggingerror-handling

Global Error Handler Block

A reusable ON BLOCK EXIT pattern that wraps your entire flow. Any unhandled exception is caught here, written to a SharePoint error log list with full context (step, message, machine, timestamp), and a Teams or email notification is sent. The flow exits cleanly without leaving zombie processes.

Members OnlySign in or create a free account to view and copy this pattern.

Usage Notes

  • Place this ON BLOCK EXIT at the very top level of your flow — it catches every exception that bubbles up.
  • Set varFlowName, varFlowVersion, and varEnvironment once at flow startup so every log entry is self-identifying.
  • The SharePoint log list needs columns: FlowName, StepName, ErrorMessage, MachineName, Environment, Timestamp.
  • Pair with Teams Error Notification (called inside the CATCH block) for real-time alerting.
  • Always include a final cleanup section (close Excel, close browser, delete temp files) before the flow exits — even on error.

Requirements

  • Power Automate Desktop 2.30+
  • SharePoint list with error log schema (or substitute with a CSV append)
  • Variables: varFlowName (Text), varFailedStep (Text), varErrorMessage (Text), varEnvironment (Text)