Sauce-0.10.1: sauce/exceptions.h Source File

Sauce-0.10.1 A C++ Dependency Injection Framework

- Main Page
- Classes
- Files

- File List

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>
31 class UnboundExceptionFor: public UnboundException {
32 public:
33 UnboundExceptionFor(std::string const name): UnboundException(name) {}
34 };
35
39 class PartialBindingException: public Exception {
40 public:
41 PartialBindingException():
42 Exception("Binding is incomplete.") {}
43 };
44
48 template<typename Dependency>
49 class PartialBindingExceptionFor: public PartialBindingException {
50 public:
51 PartialBindingExceptionFor(): PartialBindingException() {}
52 };
53
57 class CircularDependencyException: public Exception {
58 public:
59 CircularDependencyException():
60 Exception("Request for unbound interface.") {}
61 };
62
66 template<typename Dependency>
67 class CircularDependencyExceptionFor: public CircularDependencyException {
68 public:
69 CircularDependencyExceptionFor(): CircularDependencyException() {}
70 };
71
75 class OutOfScopeException: public Exception {
76 public:
77 OutOfScopeException():
78 Exception("Out of dependency scope.") {}
79 };
80
84 template<typename Scope>
85 class OutOfScopeExceptionFor: public OutOfScopeException {
86 public:
87 OutOfScopeExceptionFor(): OutOfScopeException() {}
88 };
89
93 class AlreadyInScopeException: public Exception {
94 public:
95 AlreadyInScopeException():
96 Exception("Already in scope.") {}
97 };
98
102 template<typename Scope>
103 class AlreadyInScopeExceptionFor: public AlreadyInScopeException {
104 public:
105 AlreadyInScopeExceptionFor(): AlreadyInScopeException() {}
106 };
107
111 class ExitingSingletonScopeException: public Exception {
112 public:
113 ExitingSingletonScopeException():
114 Exception("Can't exit SingletonScope") {}
115 };
116
117 }
118
119 #endif // SAUCE_EXCEPTIONS_H_