1 | /******************************************************************************* |
2 | Copyright (c) The Taichi Authors (2016- ). All Rights Reserved. |
3 | The use of this software is governed by the LICENSE file. |
4 | *******************************************************************************/ |
5 | |
6 | #pragma once |
7 | |
8 | #include "taichi/common/core.h" |
9 | |
10 | #include <exception> |
11 | |
12 | namespace taichi { |
13 | |
14 | class ExceptionForPython : public std::exception { |
15 | private: |
16 | std::string msg_; |
17 | |
18 | public: |
19 | explicit ExceptionForPython(const std::string &msg) : msg_(msg) { |
20 | } |
21 | char const *what() const noexcept override { |
22 | return msg_.c_str(); |
23 | } |
24 | }; |
25 | |
26 | void raise_assertion_failure_in_python(const std::string &msg); |
27 | |
28 | } // namespace taichi |
29 | |