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

Function print_string_value

modules/console.cpp:222–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220}
221
222std::string print_string_value(JSContext* cx, JS::HandleValue v_string) {
223 if (!v_string.isString())
224 return "[unexpected result from printing value]";
225
226 JS::RootedString printed_string(cx, v_string.toString());
227 JS::AutoSaveExceptionState exc_state(cx);
228 JS::UniqueChars chars(JS_EncodeStringToUTF8(cx, printed_string));
229 exc_state.restore();
230 if (!chars)
231 return "[error printing value]";
232
233 return chars.get();
234}
235
236/* Return value of false indicates an uncatchable exception, rather than any
237 * exception. (This is because the exception should be auto-printed around the

Callers 1

Calls 2

toStringMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected