We have been receiving several questions about how to implement error handling in ADF pipelines so let us take a quick look around this concept and how this could be simplified –
The very first thing we need to handle the errors is to add a path to the activity so that if there is any error, the flow is redirected to the path intended for its handling.

Each activity provides the error information by different means so let us see how the errors encountered during an activity’s execution could be caught.
If this has been Lookup Activity, you can catch the error as –
activity(‘Lookup Activity’).Error.Message
For Copy Data activity, this can be caught as –
activity(‘Copy Data Activity’).output.errors[0].Message
However, this is not straightforward for Execute Pipeline Activity which involves a series of steps and hence is being covered in a separate dedicated post that you can find here.