1

I'm using Azure Logic App. This is the architecture:

Insert Row

I have a Scope Insert Row that include an insert statement in database. I would like to send via mail the message of the exception of the insertion. For example if the Insert statement failed with Foreign key exception, i would like to send this message.

How can I refer to this error message inside the 'Send error Msg' feature?

Thanks a lot guys :)

davide.ferrari
  • 221
  • 2
  • 10
  • Have you seen this in the documentation? https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-scenario-error-and-exception-handling – Alberto Vega Apr 08 '19 at 23:38

2 Answers2

2

You could set the Configure run after value to implement it. Set the Send an email action run after Insert row has failed.

enter image description here

enter image description here

If the Insert action success, the send mail won't execute and if it fails the send mail would work. You could also add the run after action value like the time out or is skipped, they are all kind of exceptions.

enter image description here

enter image description here

UPDATE: If this is your error message, you could add it with @{body('Insert_row')?['message']} in code view mode.

And here is my error message and the subject setting.

enter image description here

enter image description here

enter image description here

enter image description here

George Chen
  • 13,703
  • 2
  • 11
  • 26
  • Thanks a lot George. How can I obtain the description of the failure in the **Subject** of the _Send an email_ statement?. For example, if I want a _Subject_ like: "**insert action failed: {Foreign key exception [...]}**" – davide.ferrari Apr 09 '19 at 07:39
  • @davide.ferrari, I have updated my answer, check if this is what you want. If you have other questions, please let me know. – George Chen Apr 09 '19 at 07:53
  • And if this could help you, you could mark it as the answer. Thanks! – George Chen Apr 09 '19 at 07:53
  • Since we have already handled the error, how do we make the logic app run as success in the history? @GeorgeChen – Ashokan Sivapragasam Feb 21 '21 at 12:35
0

You can make use of Filter Array and result function to capture the actual error of an action failed in a Scope.

For more insights with example see following article - How can I handle exception in Azure Logic App

Thanks, Maheshkumar Tiwari TechFindings...by Maheshkumar Tiwari