-
-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathNativeScriptException.h
More file actions
51 lines (44 loc) · 2.08 KB
/
NativeScriptException.h
File metadata and controls
51 lines (44 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef NativeScriptException_h
#define NativeScriptException_h
#include <string>
#include "Common.h"
namespace tns {
class NativeScriptException {
public:
NativeScriptException(const std::string& message);
NativeScriptException(v8::Isolate* isolate, v8::TryCatch& tc,
const std::string& message);
NativeScriptException(v8::Isolate* isolate, const std::string& message,
const std::string& name = "NativeScriptException");
~NativeScriptException();
void ReThrowToV8(v8::Isolate* isolate);
const std::string& getMessage() const { return message_; }
const std::string& getStackTrace() const { return stackTrace_; }
static void OnUncaughtError(v8::Local<v8::Message> message,
v8::Local<v8::Value> error);
static void ShowErrorModal(v8::Isolate* isolate,
const std::string& title,
const std::string& message,
const std::string& stackTrace);
static void SubmitConsoleErrorPayload(v8::Isolate* isolate,
const std::string& payload);
private:
v8::Persistent<v8::Value>* javascriptException_;
std::string name_;
std::string message_;
std::string stackTrace_;
std::string fullMessage_;
static std::string GetErrorStackTrace(
v8::Isolate* isolate, const v8::Local<v8::StackTrace>& stackTrace);
static std::string GetErrorMessage(v8::Isolate* isolate,
v8::Local<v8::Value>& error,
const std::string& prependMessage = "");
static std::string GetFullMessage(v8::Isolate* isolate,
const v8::TryCatch& tc,
const std::string& jsExceptionMessage);
static std::string GetFullMessage(v8::Isolate* isolate,
v8::Local<v8::Message> message,
const std::string& jsExceptionMessage);
};
} // namespace tns
#endif /* NativeScriptException_h */