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
7 //
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)
10 
11 #ifndef BOOST_PROCESS_DETAIL_INITIALIZERS_THROW_ON_ERROR_HPP
12 #define BOOST_PROCESS_DETAIL_INITIALIZERS_THROW_ON_ERROR_HPP
13 
14 #include <boost/process/detail/config.hpp>
15 #include <boost/process/detail/handler_base.hpp>
16 
17 namespace boost { namespace process { namespace detail {
18 
19 struct throw_on_error_ : ::boost::process::detail::handler
20 {
21     template <class Executor>
on_errorboost::process::detail::throw_on_error_22     void on_error(Executor& exec, const std::error_code & ec) const
23     {
24         throw process_error(ec, "process creation failed");
25     }
26 
operator ()boost::process::detail::throw_on_error_27     const throw_on_error_ &operator()() const {return *this;}
28 };
29 
30 }
31 
32 constexpr boost::process::detail::throw_on_error_ throw_on_error;
33 
34 }}
35 
36 #endif
37