Skip to Content
C# and .NET Core Test-Driven Development
book

C# and .NET Core Test-Driven Development

by Ayobami Adewole
May 2018
Intermediate to advanced content levelIntermediate to advanced
300 pages
7h 35m
English
Packt Publishing
Content preview from C# and .NET Core Test-Driven Development

Cake's error handling and finally block

Cake has error handling techniques that you can use to recover from errors or graciously handle exceptions whenever they occur during the build process. Sometimes build steps call external services or processes; invocation of these external dependencies might cause errors that can cause the overall build to fail. A robust build should handle such exceptions without stopping the entire build process.

The OnError method is a task extension that is used when you need to act on an exception generated in the build. Instead of forcefully terminating the script, you can write code to handle the error in the OnError method:

Task("Task1").Does(() =>{}).OnError(exception =>{    // Code to handle exception.});
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On Design Patterns with C# and .NET Core

Hands-On Design Patterns with C# and .NET Core

Gaurav Aroraa, Jeffrey Chilberto
.NET Core in Action

.NET Core in Action

Dustin Metzgar

Publisher Resources

ISBN: 9781788292481Supplemental Content