00001 00002 // Copyright Florian Winter 2010 - 2010. 00003 // Distributed under the Boost Software License, Version 1.0. 00004 // (See accompanying file LICENSE_1_0.txt or copy at 00005 // http://www.boost.org/LICENSE_1_0.txt) 00006 00007 00008 #ifndef TK11_EXCEPTIONS_HPP 00009 #define TK11_EXCEPTIONS_HPP 00010 00017 #include "utils.hpp" 00018 00019 namespace tk11 { 00020 00022 00028 struct Failed_To_Register_Window_Class : public Exception {}; 00029 00031 00036 struct Failed_To_Create_Window : public Exception {}; 00037 00039 00047 struct Register_Raw_Input_Failed : public Exception {}; 00048 00050 00056 struct File_Not_Found : public Exception {}; 00057 00059 00066 struct Direct3D_Error : public Exception {}; 00067 00068 00069 namespace detail { 00070 struct hresult_tag; 00071 } 00072 00074 00078 typedef boost::error_info<detail::hresult_tag, HRESULT> errinfo_hresult; 00079 } 00080 00081 00083 00096 #define TK11_CHECK_RESULT(x, function) \ 00097 { \ 00098 HRESULT hresult_123 = (x); \ 00099 if(!SUCCEEDED(hresult_123)) { \ 00100 BOOST_THROW_EXCEPTION(Direct3D_Error() \ 00101 << boost::errinfo_api_function(function) \ 00102 << errinfo_hresult(hresult_123)); \ 00103 } \ 00104 } 00105 00106 #endif