Btk
exception.hpp
1 #if !defined(_BTK_EXCEPTION_HPP_)
2 #define _BTK_EXCEPTION_HPP_
3 #include <stdexcept>
4 #include <exception>
5 #include <thread>
6 #include "defs.hpp"
7 namespace Btk{
8  //SDLError
9  typedef std::runtime_error RuntimeError;
10  class BTKAPI SDLError:public RuntimeError{
11  public:
12  SDLError(const char *err);
13  SDLError(const SDLError &);
14  ~SDLError();
15  };
16  class BTKAPI BadFunctionCall:public RuntimeError{
17  public:
20  ~BadFunctionCall();
21  };
22  class BTKAPI RendererError:public RuntimeError{
23  public:
24  RendererError(const char *msg);
25  RendererError(const RendererError &) = default;
26  ~RendererError();
27  };
28 
29  enum class ThreadType{
30  AsyncWorker,// The AsyncWorker
31  Renderer,//< The Rendering thread
32  Unknown,//< Unknown thread
33  };
34  struct ExceptionData{
35  std::exception_ptr ptr;//<The exception
36  std::thread::id whence;//<The thread id
37  ThreadType thread_type;//<The thread type
38  };
39  //typedef bool (*ExceptionHandler)(ExceptionData);
40 
41  [[noreturn]] void BTKAPI throwRuntimeError(const char *);
42  [[noreturn]] void BTKAPI throwSDLError(const char *);
43  [[noreturn]] void BTKAPI throwSDLError();
44  //throw BadFunctionCall
45  [[noreturn]] void BTKAPI throwBadFunctionCall();
46 
47  [[noreturn]] void BTKAPI throwRendererError(const char *msg);
48  [[noreturn]] void BTKAPI throwRendererError();
49 };
50 
51 
52 #endif // _BTK_EXCEPTION_HPP_
Definition: exception.hpp:22
This header include many useful containers.
Definition: async.hpp:7
Definition: exception.hpp:34
Definition: exception.hpp:16
Definition: exception.hpp:10