* Purpose: Java Exception. Can gather the message from the JVM if need be. */
| 39 | * Purpose: Java Exception. Can gather the message from the JVM if need be. |
| 40 | */ |
| 41 | class JavaException : public std::exception { |
| 42 | public: |
| 43 | // Constructor |
| 44 | /*! |
| 45 | * Create a new JavaException |
| 46 | */ |
| 47 | JavaException(std::string errorMsg) |
| 48 | : message_(std::move(errorMsg)) { |
| 49 | } |
| 50 | |
| 51 | // Destructor |
| 52 | virtual ~JavaException() noexcept = default; |
| 53 | virtual const char * what() const noexcept { |
| 54 | return message_.c_str(); |
| 55 | } |
| 56 | |
| 57 | private: |
| 58 | // JavaException detailed information |
| 59 | std::string message_; |
| 60 | |
| 61 | }; |
| 62 | |
| 63 | static std::string getMessage(JNIEnv *env, jthrowable throwable) { |
| 64 |