Reputation: 1
While executing i got the below error.
Error
{
"errorCode": "BadRequest",
"message": "Activity parent-control-sp failed: JSON text is not properly formatted. Unexpected character '\"' is found at position 0.",
"failureType": "UserError",
"target": "Execute parent Pipeline"
}
I want the below message to be displayed in error table
Activity parent-control-sp failed: JSON text is not properly formatted. Unexpected character '\"' is found at position 0.", "failureType": "UserError", "target": "Execute parent Pipeline" }
I have used @{activity('Activity parent-control-sp').error.message}
. It is displaying the below message
JSON text is not properly formatted. Unexpected character '\"' is found at position 0.", "failureType": "UserError", "target": "Execute parent Pipeline" }
How to get the upper message?
Upvotes: 0
Views: 536
Reputation: 3745
Your error message is not a JSON message, so you cannot use the expression (@{activity('Activity parent-control-sp').error.message}
) to get what you want
Error <<== Remove this firstly!!!
{
"errorCode": "BadRequest",
"message": "Activity parent-control-sp failed: JSON text is not properly formatted. Unexpected character '\"' is found at position 0.",
"failureType": "UserError",
"target": "Execute parent Pipeline"
}
This code will get the substring of an Error message, and then you can use an expression.
# the substring
@json(substring(
activity('xxx').error.message,
indexof(activity('xxx').error.message,'{'),
add(sub(lastindexof(activity('xxx').error.message,'}'),indexof(activity('xxx').error.message,'{')),1)
))
# get what you want
.message
Upvotes: 0
Reputation: 1806
I believe you are trying to use the Execute Pipeline activity and at this point the intend to to catch any error from the child activity . I think the below expression should help you
@concat(activity('Pipeline1').error.message,'failureType:',activity('Pipeline1').error.failureType)
Upvotes: 1