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