MCPcopy Create free account
hub / github.com/GNOME/gjs / get_last_cause

Function get_last_cause

gjs/jsapi-util-error.cpp:42–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40 js::SystemAllocPolicy>;
41
42GJS_JSAPI_RETURN_CONVENTION
43static bool get_last_cause(JSContext* cx, JS::HandleValue v_exc,
44 JS::MutableHandleObject last_cause,
45 JS::MutableHandle<CauseSet> seen_causes) {
46 if (!v_exc.isObject()) {
47 last_cause.set(nullptr);
48 return true;
49 }
50 JS::RootedObject exc(cx, &v_exc.toObject());
51 CauseSet::AddPtr entry = seen_causes.lookupForAdd(exc);
52 if (entry) {
53 last_cause.set(nullptr);
54 return true;
55 }
56 if (!seen_causes.add(entry, exc)) {
57 JS_ReportOutOfMemory(cx);
58 return false;
59 }
60
61 JS::RootedValue v_cause(cx);
62 const GjsAtoms& atoms = GjsContextPrivate::atoms(cx);
63 if (!JS_GetPropertyById(cx, exc, atoms.cause(), &v_cause))
64 return false;
65
66 if (v_cause.isUndefined()) {
67 last_cause.set(exc);
68 return true;
69 }
70
71 return get_last_cause(cx, v_cause, last_cause, seen_causes);
72}
73
74GJS_JSAPI_RETURN_CONVENTION
75static bool append_new_cause(JSContext* cx, JS::HandleValue thrown,

Callers 1

append_new_causeFunction · 0.85

Calls 2

setMethod · 0.80
addMethod · 0.80

Tested by

no test coverage detected