@@ -35,7 +35,6 @@ using v8::V8;
35
35
using v8::Value;
36
36
37
37
// Internal/static function declarations
38
- void OnUncaughtException (const FunctionCallbackInfo<Value>& info);
39
38
static void Initialize (Local<Object> exports,
40
39
Local<Value> unused,
41
40
Local<Context> context);
@@ -48,14 +47,16 @@ void TriggerReport(const FunctionCallbackInfo<Value>& info) {
48
47
std::string filename;
49
48
Local<String> stackstr;
50
49
51
- CHECK_EQ (info.Length (), 2 );
52
- stackstr = info[1 ].As <String>();
50
+ CHECK_EQ (info.Length (), 4 );
51
+ String::Utf8Value message (isolate, info[0 ].As <String>());
52
+ String::Utf8Value trigger (isolate, info[1 ].As <String>());
53
+ stackstr = info[3 ].As <String>();
53
54
54
- if (info[0 ]->IsString ())
55
- filename = *String::Utf8Value (isolate, info[0 ]);
55
+ if (info[2 ]->IsString ())
56
+ filename = *String::Utf8Value (isolate, info[2 ]);
56
57
57
58
filename = TriggerNodeReport (
58
- isolate, env, " JavaScript API " , __func__ , filename, stackstr);
59
+ isolate, env, *message, *trigger , filename, stackstr);
59
60
// Return value is the report filename
60
61
info.GetReturnValue ().Set (
61
62
String::NewFromUtf8 (isolate, filename.c_str (), v8::NewStringType::kNormal )
@@ -79,22 +80,6 @@ void GetReport(const FunctionCallbackInfo<Value>& info) {
79
80
.ToLocalChecked ());
80
81
}
81
82
82
- // Callbacks for triggering report on uncaught exception.
83
- // Calls triggered from JS land.
84
- void OnUncaughtException (const FunctionCallbackInfo<Value>& info) {
85
- Environment* env = Environment::GetCurrent (info);
86
- Isolate* isolate = env->isolate ();
87
- HandleScope scope (isolate);
88
- std::string filename;
89
- std::shared_ptr<PerIsolateOptions> options = env->isolate_data ()->options ();
90
-
91
- // Trigger report if requested
92
- if (options->report_uncaught_exception ) {
93
- TriggerNodeReport (
94
- isolate, env, " exception" , __func__, filename, info[0 ].As <String>());
95
- }
96
- }
97
-
98
83
// Signal handler for report action, called from JS land (util.js)
99
84
void OnUserSignal (const FunctionCallbackInfo<Value>& info) {
100
85
Environment* env = Environment::GetCurrent (info);
@@ -239,7 +224,6 @@ static void Initialize(Local<Object> exports,
239
224
std::shared_ptr<PerIsolateOptions> options = env->isolate_data ()->options ();
240
225
env->SetMethod (exports, " triggerReport" , TriggerReport);
241
226
env->SetMethod (exports, " getReport" , GetReport);
242
- env->SetMethod (exports, " onUnCaughtException" , OnUncaughtException);
243
227
env->SetMethod (exports, " onUserSignal" , OnUserSignal);
244
228
env->SetMethod (exports, " syncConfig" , SyncConfig);
245
229
}
0 commit comments