| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 851a691 commit b2c77ec
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -116,7 +116,10 @@ function createFatalException() { | |||
| 116 | 116 | report.syncConfig(config, false); | |
| 117 | 117 | if (Array.isArray(config.events) && | |
| 118 | 118 | config.events.includes('exception')) { | |
| 119 | - report.onUnCaughtException(er ? er.stack : undefined); | ||
| 119 | + report.triggerReport(er ? er.message : 'Exception', | ||
| 120 | + 'Exception', | ||
| 121 | + null, | ||
| 122 | + er ? er.stack : undefined); | ||
| 120 | 123 | } | |
| 121 | 124 | } | |
| 122 | 125 | } catch {} // Ignore the exception. Diagnostic reporting is unavailable. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -87,7 +87,7 @@ const report = { | |||
| 87 | 87 | throw new ERR_INVALID_ARG_TYPE('err', 'Object', err); | |
| 88 | 88 | } | |
| 89 | 89 | ||
| 90 | - return nr.triggerReport(file, err.stack); | ||
| 90 | + return nr.triggerReport('JavaScript API', 'API', file, err.stack); | ||
| 91 | 91 | }, | |
| 92 | 92 | getReport(err) { | |
| 93 | 93 | emitExperimentalWarning('report'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -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 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments