| 418 | |
| 419 | v8::TryCatch catcher(_isolate); |
| 420 | auto context = _context.Get(_isolate); |
| 421 | v8::Context::Scope contextScope(context); |
| 422 | v8::Local<v8::String> string; |
| 423 | if (!jsValue->ToString(context).ToLocal(&string)) { |
| 424 | storeCaughtException(catcher, "Cannot format bigint", exceptionTracker); |
| 425 | return nullptr; |
| 426 | } |
| 427 | v8::String::Utf8Value decimal(_isolate, string); |
| 428 | if (*decimal == nullptr) { |
| 429 | storeCaughtException(catcher, "Cannot encode BigInt decimal string", exceptionTracker); |
| 430 | return nullptr; |
| 431 | } |
| 432 | return BigInt::make(std::string_view(*decimal, static_cast<size_t>(decimal.length())), exceptionTracker); |
| 433 | } |
| 434 | |
| 435 | void V8JavaScriptContext::storeCaughtException(v8::TryCatch& catcher, |
| 436 | const char* message, |
| 437 | JSExceptionTracker& exceptionTracker) { |
| 438 | if (catcher.HasCaught()) { |
| 439 | exceptionTracker.storeException( |
no test coverage detected