| 175 | } |
| 176 | |
| 177 | std::string NativeScriptException::ToString() const { |
| 178 | std::stringstream ss; |
| 179 | if (!m_javaException.IsNull()) { |
| 180 | JEnv env; |
| 181 | std::string message = GetExceptionMessage(env, m_javaException); |
| 182 | std::string stackTrace = GetExceptionStackTrace(env, m_javaException); |
| 183 | ss << "Java Exception: " << message << "\n" << stackTrace; |
| 184 | } else if (m_javascriptException != nullptr) { |
| 185 | ss << "JavaScript Exception: " << m_message << "\n" << m_stackTrace; |
| 186 | } else if (!m_message.empty()) { |
| 187 | ss << "Exception Message: " << m_message << "\n" << m_stackTrace; |
| 188 | } else { |
| 189 | ss << "No exception information available."; |
| 190 | } |
| 191 | return ss.str(); |
| 192 | } |
| 193 | |
| 194 | std::string NativeScriptException::GetErrorMessage() const { |
| 195 | if (!m_javaException.IsNull()) { |