@@ -35,7 +35,6 @@ using v8::V8;
3535using v8::Value;
3636
3737// Internal/static function declarations
38- void OnUncaughtException (const FunctionCallbackInfo<Value>& info);
3938static void Initialize (Local<Object> exports,
4039 Local<Value> unused,
4140 Local<Context> context);
@@ -48,14 +47,16 @@ void TriggerReport(const FunctionCallbackInfo<Value>& info) {
4847 std::string filename;
4948 Local<String> stackstr;
5049
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>();
5354
54- if (info[0 ]->IsString ())
55- filename = *String::Utf8Value (isolate, info[0 ]);
55+ if (info[2 ]->IsString ())
56+ filename = *String::Utf8Value (isolate, info[2 ]);
5657
5758 filename = TriggerNodeReport (
58- isolate, env, " JavaScript API " , __func__ , filename, stackstr);
59+ isolate, env, *message, *trigger , filename, stackstr);
5960 // Return value is the report filename
6061 info.GetReturnValue ().Set (
6162 String::NewFromUtf8 (isolate, filename.c_str (), v8::NewStringType::kNormal )
@@ -79,22 +80,6 @@ void GetReport(const FunctionCallbackInfo<Value>& info) {
7980 .ToLocalChecked ());
8081}
8182
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-
9883// Signal handler for report action, called from JS land (util.js)
9984void OnUserSignal (const FunctionCallbackInfo<Value>& info) {
10085 Environment* env = Environment::GetCurrent (info);
@@ -239,7 +224,6 @@ static void Initialize(Local<Object> exports,
239224 std::shared_ptr<PerIsolateOptions> options = env->isolate_data ()->options ();
240225 env->SetMethod (exports, " triggerReport" , TriggerReport);
241226 env->SetMethod (exports, " getReport" , GetReport);
242- env->SetMethod (exports, " onUnCaughtException" , OnUncaughtException);
243227 env->SetMethod (exports, " onUserSignal" , OnUserSignal);
244228 env->SetMethod (exports, " syncConfig" , SyncConfig);
245229}
0 commit comments