Azure Data Factory - Capture error details of a dataflow activity

Vivek Komarla Bhaskar 956 Reputation points
2022-08-18T16:38:34.503+00:00

Hi,

I have a data flow and my requirement is to capture the error details into a variable when it fails. I tried to achieve this as below, but I'm unable to get only the error details instead it gives me additional information.

@activity('TVAViewersByMinute-Dataflow').error.Message

232479-df-error.png

232530-variable-output.png

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,624 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Agelin, Jakob 21 Reputation points
    2022-11-24T09:54:10.46+00:00

    Adding onto this.
    I've found the best way to capture a data flow error message is by this little maneuver.

    @json(replace(activity('Data flow1').Error.message,'\','')).Message

    Message (with a capital M) is an attribute within the Error.message object. It can be replaced with StatusCode or Details.

    I save this in a string variable.

    Hope this helps!

    4 people found this answer helpful.

  2. AnnuKumari-MSFT 34,556 Reputation points Microsoft Employee Moderator
    2022-08-19T10:57:19.71+00:00

    Hi @Vivek Komarla Bhaskar ,

    Welcome to Microsoft Q&A platform and thanks for posting your question.
    As I understand your requirement, you want to store the error message of the dataflow into a variable. However, you expect only the error message to be captured instead of other metadata. Please correct me if I am wrong.

    The above output that you are getting is expected. In order to get only a error message , kindly use the following expression in 'set variable' activity. You can change the last value i.e. 1000 according to your requirement:

    @substring(string(activity('dataflow10').Error.Message),indexof(string(activity('dataflow10').Error.Message),'message'),1000)  
    

    Below are the images of set variable output before and after using substring function:

    232834-image.png

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you.
      Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators
    2 people found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.