mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
report: skip report if uncaught exception is handled
If the exception is handled by the userland process#uncaughtException handler, reports should not be generated repetitively as the process may continue to run. PR-URL: https://github.com/nodejs/node/pull/44208 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
This commit is contained in:
1 parent
003ab59fcc
commit
ff34d48d70
9 files changed
+122
-60
No files matched your search
@@ -354,6 +354,7 @@ static void ReportFatalException(Environment* env,
|
||||
}
|
||||
|
||||
node::Utf8Value trace(env->isolate(), stack_trace);
|
||||
std::string report_message = "Exception";
|
||||
|
||||
// range errors have a trace member set to undefined
|
||||
if (trace.length() > 0 && !stack_trace->IsUndefined()) {
|
||||
@@ -386,6 +387,8 @@ static void ReportFatalException(Environment* env,
|
||||
} else {
|
||||
node::Utf8Value name_string(env->isolate(), name.ToLocalChecked());
|
||||
node::Utf8Value message_string(env->isolate(), message.ToLocalChecked());
|
||||
// Update the report message if it is an object has message property.
|
||||
report_message = message_string.ToString();
|
||||
|
||||
if (arrow.IsEmpty() || !arrow->IsString() || decorated) {
|
||||
FPrintF(stderr, "%s: %s\n", name_string, message_string);
|
||||
@@ -407,6 +410,11 @@ static void ReportFatalException(Environment* env,
|
||||
}
|
||||
}
|
||||
|
||||
if (env->isolate_data()->options()->report_uncaught_exception) {
|
||||
report::TriggerNodeReport(
|
||||
isolate, env, report_message.c_str(), "Exception", "", error);
|
||||
}
|
||||
|
||||
if (env->options()->trace_uncaught) {
|
||||
Local<StackTrace> trace = message->GetStackTrace();
|
||||
if (!trace.IsEmpty()) {
|
||||
|
||||
Reference in new issue
Block a user