Error and ErrorDetail do not show the correct information

Hello,

When a Step fails in a Deployment, Octopus.Deployment.Error and Octopus.Deployment.ErrorDetail display an error and stack trace (seemingly) related to Octopus Deploy, and not to the failing script.


Octopus.Deployment.Error (and Octopus.Step[...].Status.Error) always returns the following:

One or more child activities failed.

Octopus.Deployment.ErrorDetail (and Octopus.Step[...].Status.ErrorDetail) always returns the following:

Octopus.Shared.Tasks.ActivityFailedException: One or more child activities failed.
   at Octopus.Shared.Tasks.ParallelWorkOrder`1.AssertAllCompletedTasksThusFarAreSuccessful() in y:\work\refs\heads\master\source\Octopus.Shared\Tasks\ParallelWorkOrder.cs:line 78
   at Octopus.Shared.Tasks.ParallelWorkOrder`1.Execute() in y:\work\refs\heads\master\source\Octopus.Shared\Tasks\ParallelWorkOrder.cs:line 33
   at Octopus.Shared.Tasks.OctoParallel.ForEach[T](IEnumerable`1 workItems, Nullable`1 maxParallelism, Action`1 executeCallback, CancellationToken cancellation) in y:\work\refs\heads\master\source\Octopus.Shared\Tasks\OctoParallel.cs:line 20
   at Octopus.Server.Orchestration.Deploy.DeploymentTaskController.DistributeStepAcrossMachines(PlannedStep step) in y:\work\refs\heads\master\source\Octopus.Server\Orchestration\Deploy\DeploymentTaskController.cs:line 174
   at Octopus.Server.Orchestration.Deploy.DeploymentTaskController.DispatchStep(PlannedStep step) in y:\work\refs\heads\master\source\Octopus.Server\Orchestration\Deploy\DeploymentTaskController.cs:line 76

My test script is very simple:

Function Work
{
    throw "Oops!"
    Write-Host "I worked!"
}

Work

These are the Task summary and log (click to view larger):

Task summary

Task log


I was expecting to receive something along the lines of the message in the Task log - maybe there’s a different way to get that:

Oops!
At C:\Octopus\Work\20150806194709-94\Script.ps1:3 char:5
+ throw "Oops!"
+ ~~~~~~~~~~~~~
 + CategoryInfo : OperationStopped: (Oops!:String) [], RuntimeExce 
 ption
 + FullyQualifiedErrorId : Oops!

The remote script failed with exit code 1

Any help would be greatly appreciated!

Thanks,
Jesse

Hi Jesse,

I can see what you mean; the values being stored in those variables aren’t as useful as they could be. I have created an issue for us to try and improve those.

In the meantime, could you capture the error yourself, and store it in your own variable? A similar approach was discussed in the comments of this issue.

If we can provide any further assistance, don’t hesitate to get back to us.

Regards,
Michael R

Michael - Excellent, thanks for the feedback and suggestion.

Even though the custom variable approach is definitely workable, I am looking forward to a built-in solution.

Does this seem like something that will get changed sometime soon? Or do you think it will be a far out future change/fix? I am not looking for a set deadline, just a generalized priority level.

Thanks,
Jesse

Jesse,

I’ve not marked it ‘high-priority’, simply because there is a work-around.
Which, with our current backlog, translates into weeks rather than days.

I hope you understand. It’s in the queue!

Regards,
Michael R

Michael - great, thanks for the update.

Should I leave this discussion open and you will update if the fix/change makes it to release? Or just close the discussion?

Thanks,
Jesse

Jesse,

It’s fine to leave it open.

I’ve added a comment to the GitHub issue, requesting that this ticket be updated when it’s implemented.

Happy Deploying!

Michael - Fantastic, thanks!

Hi Jesse

Just wanted to let you know that this was implemented in 3.3.20: https://github.com/OctopusDeploy/Issues/issues/1872

Thanks!
Dalmiro

@DalmiroGrañas That is awesome news - thanks so much!