MCPcopy Create free account
hub / github.com/Snapchat/Valdi / onPromiseComplete

Method onPromiseComplete

valdi_core/src/valdi_core/cpp/Utils/Marshaller.cpp:219–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217}
218
219void Marshaller::onPromiseComplete(int index, const Ref<ValueFunction>& callback) {
220 auto promise = getOrUndefinedAsRef(index).checkedToValdiObject<Promise>(_exceptionTracker);
221 if (promise != nullptr) {
222 promise->onComplete([callback](const Result<Value>& result) {
223 if (result) {
224 (*callback)({result.value()});
225 } else {
226 (*callback)({Value(result.error())});
227 }
228 });
229 }
230}
231
232bool Marshaller::operator!=(const Marshaller& other) const {
233 return !(*this == other);

Calls 4

ValueClass · 0.70
onCompleteMethod · 0.65
valueMethod · 0.65
errorMethod · 0.65

Tested by

no test coverage detected