Pipeline template for handling errors