Useful error email template?

I’m using the template mentioned at the bottom of http://docs.octopusdeploy.com/display/OD/Email+notifications

#{Octopus.Deployment.Error}

#{Octopus.Deployment.ErrorDetail}

#{each step in Octopus.Step}
#{if step.Status.Code}

  • #{step | HtmlEscape} — #{step.Status.Code}
    #{if step.Status.Error}
    #{step.Status.Error | HtmlEscape}

    #{step.Status.ErrorDetail | HtmlEscape}

    #{/if}

  • #{/if}

    Unfortunately it dumps out a ton of information, and none of it is even slightly useful.

    I have a deployment error. If I look at the release on the Octopus server, I immediately see that the problem is a bad config transform. The error email contains a big call stack and doesn’t even mention the bad transform. How can I email out the actual error that caused the deployment to fail?

    This is what is emailed:
    Activity Deploy Website on QAHDFS1 failed with error 'The remote script failed with exit code 1'.
    Octopus.Shared.Tasks.ActivityFailedException: Activity Deploy Website on QAHDFS1 failed with error 'The remote script failed with exit code 1'. —> System.AggregateException: One or more errors occurred. —> Octopus.Shared.Tasks.ActionFailedException: Deploy Website on QAHDFS1 —> Octopus.Shared.Tasks.ActivityFailedException: The remote script failed with exit code 1
    at Octopus.Worker.Scripting.ScriptResult.EnsureSuccessful() in Y:\Work\refs\tags\3.4.11\source\Octopus.Worker\Scripting\ScriptResult.cs:line 69
    at Octopus.Server.Orchestration.Deploy.Package.PackageActionHandler.Execute(ActionCommand command, Machine machine) in Y:\Work\refs\tags\3.4.11\source\Octopus.Server\Orchestration\Deploy\Package\PackageActionHandler.cs:line 37
    at Octopus.Server.Orchestration.Deploy.DeploymentTaskController.<>c__DisplayClass24_0.b__0() in Y:\Work\refs\tags\3.4.11\source\Octopus.Server\Orchestration\Deploy\DeploymentTaskController.cs:line 284
    at Octopus.Server.Orchestration.Deploy.DeploymentTaskController.ExecuteWithTransientErrorDetection(Action action, Machine machine) in Y:\Work\refs\tags\3.4.11\source\Octopus.Server\Orchestration\Deploy\DeploymentTaskController.cs:line 389
    at Octopus.Server.Orchestration.Deploy.DeploymentTaskController.ExecuteActionAndInitLoggingContext(PlannedStep step, Machine machine, PlannedAction action) in Y:\Work\refs\tags\3.4.11\source\Octopus.Server\Orchestration\Deploy\DeploymentTaskController.cs:line 281
    — End of inner exception stack trace —
    at Octopus.Server.Orchestration.Deploy.DeploymentTaskController.ExecuteActionAndInitLoggingContext(PlannedStep step, Machine machine, PlannedAction action) in Y:\Work\refs\tags\3.4.11\source\Octopus.Server\Orchestration\Deploy\DeploymentTaskController.cs:line 290
    at Octopus.Server.Orchestration.Deploy.DeploymentTaskController.ExecuteOneOrMoreActions(PlannedStep step, Machine machine) in Y:\Work\refs\tags\3.4.11\source\Octopus.Server\Orchestration\Deploy\DeploymentTaskController.cs:line 255
    at Octopus.Shared.Tasks.OctoThreadClosure1.Execute() in Y:\Work\refs\tags\3.4.11\source\Octopus.Shared\Tasks\OctoThreadClosure.cs:line 28 --- End of inner exception stack trace --- --- End of inner exception stack trace --- at Octopus.Shared.Tasks.ParallelWorkOrder1.AssertAllCompletedTasksThusFarAreSuccessful() in Y:\Work\refs\tags\3.4.11\source\Octopus.Shared\Tasks\ParallelWorkOrder.cs:line 81
    at Octopus.Shared.Tasks.ParallelWorkOrder1.Execute() in Y:\Work\refs\tags\3.4.11\source\Octopus.Shared\Tasks\ParallelWorkOrder.cs:line 33 at Octopus.Shared.Tasks.OctoParallel.ForEach[T](IEnumerable1 workItems, Nullable1 maxParallelism, Action1 executeCallback, CancellationToken cancellation) in Y:\Work\refs\tags\3.4.11\source\Octopus.Shared\Tasks\OctoParallel.cs:line 21
    at Octopus.Server.Orchestration.Deploy.DeploymentTaskController.DistributeStepAcrossMachinesForOneOrMoreActions(PlannedStep step, MachineSelection selection, Nullable`1 parallelism, MachineCriteria machineCriteria) in Y:\Work\refs\tags\3.4.11\source\Octopus.Server\Orchestration\Deploy\DeploymentTaskController.cs:line 251
    at Octopus.Server.Orchestration.Deploy.DeploymentTaskController.DistributeStepAcrossMachines(PlannedStep step) in Y:\Work\refs\tags\3.4.11\source\Octopus.Server\Orchestration\Deploy\DeploymentTaskController.cs:line 219
    at Octopus.Server.Orchestration.Deploy.DeploymentTaskController.DispatchStep(PlannedStep step) in Y:\Work\refs\tags\3.4.11\source\Octopus.Server\Orchestration\Deploy\DeploymentTaskController.cs:line 104

    Using Octopus 3.4.11

    Hi Matthew,

    Unfortunately we don’t have a way of including anything more useful in those error variables yet. We made a change recently to improve this slightly, but to fix it “properly” and get the true errors is difficult because of how Octopus is currently designed. Here’s the issue:

    Sorry I don’t have better news!

    Paul Stovell

    OK, well, a little disappointing but I just put this in my email template and that should be good enough:

    See here for the error.