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

Function gjs_test_get_exception_message

test/gjs-test-common.cpp:18–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16#include "test/gjs-test-common.h"
17
18char* gjs_test_get_exception_message(JSContext* cx) {
19 if (!JS_IsExceptionPending(cx))
20 return nullptr;
21
22 JS::RootedValue v_exc(cx);
23 g_assert_true(JS_GetPendingException(cx, &v_exc));
24 g_assert_true(v_exc.isObject());
25
26 JS::RootedObject exc(cx, &v_exc.toObject());
27 JSErrorReport* report = JS_ErrorFromException(cx, exc);
28 g_assert_nonnull(report);
29
30 char* retval = g_strdup(report->message().c_str());
31 g_assert_nonnull(retval);
32 JS_ClearPendingException(cx);
33 return retval;
34}

Callers 3

Calls 1

messageMethod · 0.45

Tested by

no test coverage detected