Panic.hpp
Go to the documentation of this file.
1 
33 #ifndef LVR2_UTIL_PANIC_H_
34 #define LVR2_UTIL_PANIC_H_
35 
36 #include <exception>
37 #include <iostream>
38 #include <string>
39 
40 namespace lvr2
41 {
42 
46 struct PanicException : public std::exception
47 {
48  PanicException(std::string msg) : m_msg(msg) {}
49 
50  virtual const char* what() const noexcept
51  {
52  return m_msg.c_str();
53  }
54 
55 private:
56  std::string m_msg;
57 };
58 
59 
60 struct VertexLoopException : public std::exception
61 {
62  VertexLoopException(std::string msg) : m_msg(msg) {}
63 
64  virtual const char* what() const noexcept
65  {
66  return m_msg.c_str();
67  }
68 private:
69  std::string m_msg;
70 };
71 
75 inline void panic(std::string msg)
76 {
77  throw PanicException("Program panicked: " + msg);
78 }
79 
84 inline void panic_unimplemented(std::string msg)
85 {
86  throw PanicException("Program panicked due to missing implementation: " + msg);
87 }
88 
89 
90 } // namespace lvr2
91 
92 
93 #endif // LVR2_UTIL_PANIC_H_
void panic(std::string msg)
Throws a panic exception with the given error message.
Definition: Panic.hpp:75
virtual const char * what() const noexcept
Definition: Panic.hpp:64
An exception denoting an internal bug.
Definition: Panic.hpp:46
std::string m_msg
Definition: Panic.hpp:56
void panic_unimplemented(std::string msg)
Throws a panic exception with the given error message and denotes that the exception was thrown due t...
Definition: Panic.hpp:84
PanicException(std::string msg)
Definition: Panic.hpp:48
virtual const char * what() const noexcept
Definition: Panic.hpp:50
VertexLoopException(std::string msg)
Definition: Panic.hpp:62


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Mon Feb 28 2022 22:46:08