1 // Copyright (c) 2006, 2007 Julio M. Merino Vidal
2 // Copyright (c) 2008 Ilya Sokolov, Boris Schaeling
3 // Copyright (c) 2009 Boris Schaeling
4 // Copyright (c) 2010 Felipe Tanus, Boris Schaeling
5 // Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling
6 // Copyright (c) 2016 Klemens D. Morgenstern
8 // Distributed under the Boost Software License, Version 1.0. (See accompanying
9 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11 #ifndef BOOST_PROCESS_DETAIL_INITIALIZERS_THROW_ON_ERROR_HPP
12 #define BOOST_PROCESS_DETAIL_INITIALIZERS_THROW_ON_ERROR_HPP
14 #include <boost/process/detail/config.hpp>
15 #include <boost/process/detail/handler_base.hpp>
17 namespace boost { namespace process { namespace detail {
19 struct throw_on_error_ : ::boost::process::detail::handler
21 template <class Executor>
22 void on_error(Executor& exec, const std::error_code & ec) const
24 throw process_error(ec, "process creation failed");
27 const throw_on_error_ &operator()() const {return *this;}
32 constexpr boost::process::detail::throw_on_error_ throw_on_error;