From 210d864aa2c1b5921a14fa2a938ec260b971c053 Mon Sep 17 00:00:00 2001 From: Dylan Conway Date: Tue, 9 Jul 2024 19:31:25 -0700 Subject: [PATCH] errors --- src/bun.js/bindings/webcore/SerializedScriptValue.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/bun.js/bindings/webcore/SerializedScriptValue.cpp b/src/bun.js/bindings/webcore/SerializedScriptValue.cpp index 2f71b3af075aad..4510a195905283 100644 --- a/src/bun.js/bindings/webcore/SerializedScriptValue.cpp +++ b/src/bun.js/bindings/webcore/SerializedScriptValue.cpp @@ -2574,6 +2574,8 @@ SerializationReturnCode CloneSerializer::serialize(JSValue in) if (!startMap(inMap)) break; JSMapIterator* iterator = JSMapIterator::create(m_lexicalGlobalObject, m_lexicalGlobalObject->mapIteratorStructure(), inMap, IterationKind::Entries); + if (UNLIKELY(scope.exception())) + return SerializationReturnCode::ExistingExceptionError; m_gcBuffer.appendWithCrashOnOverflow(inMap); m_gcBuffer.appendWithCrashOnOverflow(iterator); mapIteratorStack.append(iterator); @@ -2620,6 +2622,8 @@ SerializationReturnCode CloneSerializer::serialize(JSValue in) if (!startSet(inSet)) break; JSSetIterator* iterator = JSSetIterator::create(m_lexicalGlobalObject, m_lexicalGlobalObject->setIteratorStructure(), inSet, IterationKind::Keys); + if (UNLIKELY(scope.exception())) + return SerializationReturnCode::ExistingExceptionError; m_gcBuffer.appendWithCrashOnOverflow(inSet); m_gcBuffer.appendWithCrashOnOverflow(iterator); setIteratorStack.append(iterator);