summaryrefslogtreecommitdiff
path: root/src/node_report_module.cc
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2019-02-22 14:52:42 -0500
committercjihrig <cjihrig@gmail.com>2019-02-26 17:04:56 -0500
commitd64aea059902efb32f01c46c9ac0467662d93628 (patch)
treed6354fea1f0d87198182bd7704c168e20447c5d2 /src/node_report_module.cc
parente3d4a7d9994ff7d1bd144779f8b91d8302112bc0 (diff)
downloadandroid-node-v8-d64aea059902efb32f01c46c9ac0467662d93628.tar.gz
android-node-v8-d64aea059902efb32f01c46c9ac0467662d93628.tar.bz2
android-node-v8-d64aea059902efb32f01c46c9ac0467662d93628.zip
report: refactor triggerReport()
This commit fixes the triggerReport() argument validation. The existing test is also updated, as it was not passing the Error object to triggerReport(). PR-URL: https://github.com/nodejs/node/pull/26268 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_report_module.cc')
-rw-r--r--src/node_report_module.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/node_report_module.cc b/src/node_report_module.cc
index f56da94bac..0e3f8981b7 100644
--- a/src/node_report_module.cc
+++ b/src/node_report_module.cc
@@ -48,12 +48,11 @@ void TriggerReport(const FunctionCallbackInfo<Value>& info) {
std::string filename;
Local<String> stackstr;
- if (info.Length() == 1) {
- stackstr = info[0].As<String>();
- } else {
+ CHECK_EQ(info.Length(), 2);
+ stackstr = info[1].As<String>();
+
+ if (info[0]->IsString())
filename = *String::Utf8Value(isolate, info[0]);
- stackstr = info[1].As<String>();
- }
filename = TriggerNodeReport(
isolate, env, "JavaScript API", __func__, filename, stackstr);