Task error handling in Cake

0

We're using Bamboo to run our builds, along with Cake. I'm trying to use Cake's Task.OnError method to handle an intermittent error from our unit tests - logging the error if it's a particular exception type, throwing it otherwise. However, it looks like the error handling has no effect, as the error still fails our builds.

Here's my OnError usage:

.OnError(exception =>
{
    if (exception.GetType().FullName == "NUnit.Engine.NUnitEngineUnloadException")
    {
        Information($"Ignoring {exception.GetType().FullName} as this gets thrown from time-to-time.{Environment.NewLine}{exception}.");
    }
    else
    {
        throw exception;
    }
});

An example of what we see in the Bamboo logs is:

NUnit.Engine.NUnitEngineUnloadException :
 Multiple exceptions encountered. Retrieve AggregatedExceptions property for more information
----> NUnit.Engine.NUnitEngineUnloadException :
       Agent Process was terminated successfully after error.
----> NUnit.Engine.NUnitEngineUnloadException :
       Exception encountered unloading application domain
----> NUnit.Engine.NUnitEngineException :
       Exception encountered unloading application domain: Error while unloading appdomain. (Exception from HRESULT: 0x80131015)

Can anyone assist? The Cake documentation is fairly light.

c#
bamboo
nunit-3.0
cakebuild
asked on Stack Overflow May 13, 2018 by Richard Ev • edited Jul 6, 2018 by Richard Ev

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0