| 141 | */ |
| 142 | template < typename Exception, typename... Args > |
| 143 | [[noreturn]] void throw_lippincott( |
| 144 | OpenGeodeException::TYPE type, const Args&... message ) |
| 145 | { |
| 146 | try |
| 147 | { |
| 148 | throw; |
| 149 | } |
| 150 | catch( OpenGeodeException& exception ) |
| 151 | { |
| 152 | Exception new_exception{ exception.data(), type, message... }; |
| 153 | new_exception.set_parent( std::move( exception ) ); |
| 154 | throw new_exception; |
| 155 | } |
| 156 | catch( const std::exception& exception ) |
| 157 | { |
| 158 | Exception new_exception{ nullptr, type, message... }; |
| 159 | Exception std_exception{ nullptr, |
| 160 | OpenGeodeException::TYPE::internal, |
| 161 | "std::exception: ", exception.what() }; |
| 162 | new_exception.set_parent( std::move( std_exception ) ); |
| 163 | throw new_exception; |
| 164 | } |
| 165 | catch( ... ) |
| 166 | { |
| 167 | Exception new_exception{ nullptr, type, message... }; |
| 168 | Exception unknown_exception{ nullptr, |
| 169 | OpenGeodeException::TYPE::internal, "Unknown exception" }; |
| 170 | new_exception.set_parent( std::move( unknown_exception ) ); |
| 171 | throw new_exception; |
| 172 | } |
| 173 | } |
| 174 | } // namespace geode |