scsl  0.1.1
Shimmering Clarity Standard Library
Exceptions.h
1 //
2 // Created by kyle on 2023-10-10.
3 //
4 
5 #ifndef SCSL_EXCEPTIONS_H
6 #define SCSL_EXCEPTIONS_H
7 
8 
9 #include <exception>
10 #include <string>
11 
12 namespace scsl {
13 
14 
19 class NotImplemented : public std::exception {
20 public:
22  explicit NotImplemented(const char *pl) : platform((char *)pl) {}
23 
25  const char *what() const throw() {
26  return this->platform;
27  }
28 private:
29  char *platform;
30 };
31 
32 
34 class AssertionFailed : public std::exception {
35 public:
38  explicit AssertionFailed(std::string message);
39 
41  const char *what() const throw();
42 
43 private:
44  std::string msg;
45 };
46 
47 
48 } // namespace scsl
49 
50 
51 #endif //SCSL_EXCEPTIONS_H
AssertionFailed indicates that some invariant didn't hold.
Definition: Exceptions.h:34
AssertionFailed(std::string message)
Definition: Exceptions.cc:11
const char * what() const
what returns a message describing the exception.
Definition: Exceptions.cc:16
Definition: Exceptions.h:19
const char * what() const
what returns a message naming the platform.
Definition: Exceptions.h:25
NotImplemented(const char *pl)
NotImplemented exceptions are constructed with a platform name.
Definition: Exceptions.h:22
scsl is the top-level namespace containing all the code in this library.
Definition: scsl.h:37