Macaulay2 Engine
Loading...
Searching...
No Matches
exceptions.hpp
Go to the documentation of this file.
1#ifndef _exceptions_h_
2#define _exceptions_h_
3
36
37#include <stdexcept>
38#include <string>
39
40namespace exc {
41struct engine_error : public std::runtime_error
42{
43 explicit engine_error(const std::string &msg) : std::runtime_error(msg) {}
44};
46{
47 explicit overflow_exception(const std::string &msg) : engine_error(msg) {}
48};
50{
51 explicit division_by_zero_error(const std::string &msg) : engine_error(msg) {}
52 explicit division_by_zero_error() : engine_error(std::string{"division by zero"}) {}
53};
55{
56 explicit internal_error(const std::string &msg) : engine_error(msg) {}
57};
58}
59
60#define TRY \
61 try \
62 {
63#define CATCH \
64 } \
65 catch (const exc::engine_error& __x424621) \
66 { \
67 ERROR(__x424621.what()); \
68 return NULL; \
69 }
70
71#endif
72// Local Variables:
73// compile-command: "make -C $M2BUILDDIR/Macaulay2/e "
74// indent-tabs-mode: nil
75// End:
STL namespace.
division_by_zero_error(const std::string &msg)
engine_error(const std::string &msg)
internal_error(const std::string &msg)
overflow_exception(const std::string &msg)