sea: use JSON configuration and blob content for SEA

PR-URL: https://github.com/nodejs/node/pull/47125
Refs: https://github.com/nodejs/single-executable/discussions/58
Reviewed-By: Darshan Sen <raisinten@gmail.com>
This commit is contained in:
Joyee Cheung authored and RafaelGSS committed 2023-04-13 16:48:53 -03:00
1 parent 37d12730ab
commit 2bde0059ca
16 files changed
+639 -45

No files matched your search

+23 -5
View File
@@ -246,14 +246,19 @@ void PrintStackTrace(Isolate* isolate, Local<StackTrace> stack) {
std::string FormatCaughtException(Isolate* isolate,
Local<Context> context,
Local<Value> err,
Local<Message> message) {
Local<Message> message,
bool add_source_line = true) {
std::string result;
node::Utf8Value reason(isolate,
err->ToDetailString(context)
.FromMaybe(Local<String>()));
bool added_exception_line = false;
std::string source =
GetErrorSource(isolate, context, message, &added_exception_line);
std::string result = source + '\n' + reason.ToString() + '\n';
if (add_source_line) {
bool added_exception_line = false;
std::string source =
GetErrorSource(isolate, context, message, &added_exception_line);
result = source + '\n';
}
result += reason.ToString() + '\n';
Local<v8::StackTrace> stack = message->GetStackTrace();
if (!stack.IsEmpty()) result += FormatStackTrace(isolate, stack);
@@ -1209,6 +1214,19 @@ void TriggerUncaughtException(Isolate* isolate, const v8::TryCatch& try_catch) {
false /* from_promise */);
}
PrinterTryCatch::~PrinterTryCatch() {
if (!HasCaught()) {
return;
}
std::string str =
FormatCaughtException(isolate_,
isolate_->GetCurrentContext(),
Exception(),
Message(),
print_source_line_ == kPrintSourceLine);
PrintToStderrAndFlush(str);
}
} // namespace errors
} // namespace node