]> www.ginac.de Git - cln.git/blob - include/cln/exception.h
Minor fixes for recent CLang.
[cln.git] / include / cln / exception.h
1 // Exception types.
2
3 #ifndef _CL_EXCEPTION_H
4 #define _CL_EXCEPTION_H
5
6 #include <string>
7 #include <stdexcept>
8
9 namespace cln {
10
11 // Base class of all exception classes thrown by CLN.
12 class runtime_exception : public std::runtime_error {
13 public:
14         runtime_exception ()
15                 : std::runtime_error(std::string()) {}
16         explicit runtime_exception (const std::string & what)
17                 : std::runtime_error(what) {}
18 };
19
20 // Thrown when an assertion is violated.
21 class notreached_exception : public runtime_exception {
22 public:
23         notreached_exception (const char* filename, int lineno);
24 };
25
26 // Thrown when a pole is encountered.
27 class division_by_0_exception : public runtime_exception {
28 public:
29         division_by_0_exception ();
30 };
31
32 // Thrown when a conversion with As(TYPE)(VALUE) fails.
33 class as_exception : public runtime_exception {
34 public:
35         as_exception (const class cl_number& obj, const char * typestring, const char * filename, int line);
36 };
37
38 }  // namespace cln
39
40 #endif /* _CL_EXCEPTION_H */