2 * copyright (c) 2010 Sveriges Television AB <info@casparcg.com>
\r
4 * This file is part of CasparCG.
\r
6 * CasparCG is free software: you can redistribute it and/or modify
\r
7 * it under the terms of the GNU General Public License as published by
\r
8 * the Free Software Foundation, either version 3 of the License, or
\r
9 * (at your option) any later version.
\r
11 * CasparCG is distributed in the hope that it will be useful,
\r
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 * GNU General Public License for more details.
\r
16 * You should have received a copy of the GNU General Public License
\r
17 * along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
\r
22 #include <exception>
\r
23 #include <boost/exception/all.hpp>
\r
24 #include <boost/exception/error_info.hpp>
\r
25 #include <boost/throw_exception.hpp>
\r
29 typedef boost::error_info<struct tag_arg_name_info, std::string> arg_name_info;
\r
30 typedef boost::error_info<struct tag_arg_value_info, std::string> arg_value_info;
\r
31 typedef boost::error_info<struct tag_msg_info, std::string> msg_info;
\r
32 typedef boost::error_info<struct tag_errorstr, std::string> errorstr;
\r
33 typedef boost::error_info<struct tag_source_info, std::string> source_info;
\r
34 typedef boost::error_info<struct tag_line_info, size_t> line_info;
\r
35 typedef boost::error_info<struct errinfo_nested_exception_, std::exception_ptr> errinfo_nested_exception;
\r
37 struct caspar_exception : virtual boost::exception, virtual std::exception
\r
39 caspar_exception(){}
\r
40 explicit caspar_exception(const char* msg) : std::exception(msg) {}
\r
43 struct io_error : virtual caspar_exception {};
\r
44 struct directory_not_found : virtual io_error {};
\r
45 struct file_not_found : virtual io_error {};
\r
46 struct file_read_error : virtual io_error {};
\r
48 struct invalid_argument : virtual caspar_exception {};
\r
49 struct null_argument : virtual invalid_argument {};
\r
50 struct out_of_range : virtual invalid_argument {};
\r
51 struct bad_alloc : virtual caspar_exception {};
\r
53 struct invalid_operation : virtual caspar_exception {};
\r
54 struct operation_failed : virtual caspar_exception {};
\r
56 struct not_supported : virtual caspar_exception {};
\r
57 struct not_implemented : virtual caspar_exception {};
\r
64 inline bool operator!=(const std::exception_ptr& lhs, const std::exception_ptr& rhs)
\r
66 return !(lhs == rhs);
\r
69 inline bool operator!=(const std::exception_ptr& lhs, std::nullptr_t)
\r
71 return !(lhs == nullptr);
\r
74 inline bool operator!=(std::nullptr_t, const std::exception_ptr& rhs)
\r
76 return !(nullptr == rhs);
\r