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

Function append_new_cause

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

Source from the content-addressed store, hash-verified

72}
73
74GJS_JSAPI_RETURN_CONVENTION
75static bool append_new_cause(JSContext* cx, JS::HandleValue thrown,
76 JS::HandleValue new_cause, bool* appended) {
77 g_assert(appended && "forgot out parameter");
78 *appended = false;
79
80 JS::Rooted<CauseSet> seen_causes(cx);
81 JS::RootedObject last_cause{cx};
82 if (!get_last_cause(cx, thrown, &last_cause, &seen_causes))
83 return false;
84 if (!last_cause)
85 return true;
86
87 const GjsAtoms& atoms = GjsContextPrivate::atoms(cx);
88 if (!JS_SetPropertyById(cx, last_cause, atoms.cause(), new_cause))
89 return false;
90
91 *appended = true;
92 return true;
93}
94
95[[gnu::format(printf, 4, 0)]]
96static void gjs_throw_valist(JSContext* cx, JSExnType error_kind,

Callers 1

gjs_throw_valistFunction · 0.85

Calls 1

get_last_causeFunction · 0.85

Tested by

no test coverage detected