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

Function makeOpaque

valdi/src/valdi/runtime/JavaScript/JavaScriptUtils.cpp:93–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91 jsError = jsContext.newError(
92 flattenedError.getMessage().toStringView(), {flattenedError.getStack().toStringView()}, exceptionTracker);
93 }
94
95 // Carry the error code onto the JS error so consumers can branch on it instead of matching the
96 // message — kPromiseCanceledErrorCode is what lets JS tell an intentional cancellation apart
97 // from a genuine failure. Only stamped when set, to keep ordinary errors unchanged.
98 const auto errorCode = flattenedError.getErrorCode();
99 if (errorCode != 0 && exceptionTracker) {
100 jsContext.setObjectProperty(
101 jsError.get(), std::string_view("code"), jsContext.newNumber(errorCode).get(), exceptionTracker);
102 }

Callers 1

runtimeMakeOpaqueMethod · 0.85

Calls 2

jsValueToValdiObjectFunction · 0.85
newWrappedObjectMethod · 0.45

Tested by

no test coverage detected