Sauce-0.10.1
A C++ Dependency Injection Framework
exceptions.h
1 #ifndef SAUCE_EXCEPTIONS_H_
2 #define SAUCE_EXCEPTIONS_H_
3 
4 #include <string>
5 #include <stdexcept>
6 
7 namespace sauce {
8 
12 class Exception: public std::runtime_error {
13 public:
14  Exception(std::string message):
15  std::runtime_error(message) {}
16 };
17 
21 class UnboundException: public Exception {
22 public:
23  UnboundException(std::string const name):
24  Exception("Request for unbound interface " + name + ".") {}
25 };
26 
30 template<typename Dependency>
32 public:
33  UnboundExceptionFor(std::string const name): UnboundException(name) {}
34 };
35 
40 public:
42  Exception("Binding is incomplete.") {}
43 };
44 
48 template<typename Dependency>
50 public:
52 };
53 
58 public:
60  Exception("Request for unbound interface.") {}
61 };
62 
66 template<typename Dependency>
68 public:
70 };
71 
76 public:
78  Exception("Out of dependency scope.") {}
79 };
80 
84 template<typename Scope>
86 public:
88 };
89 
94 public:
96  Exception("Already in scope.") {}
97 };
98 
102 template<typename Scope>
104 public:
106 };
107 
112 public:
114  Exception("Can't exit SingletonScope") {}
115 };
116 
117 }
118 
119 #endif // SAUCE_EXCEPTIONS_H_