COMPAT: Replace with a format string in C++20. Throws an exception, like "throw new Error(message)" * * If an exception is already set in the context, this will NOT overwrite it. * That's an important semantic since we want the "root cause" exception. To * overwrite, use JS_ClearPendingException() first. */ NOLINTNEXTLINE(modernize-avoid-variadic-functions)
| 167 | */ |
| 168 | // NOLINTNEXTLINE(modernize-avoid-variadic-functions) |
| 169 | void gjs_throw(JSContext* cx, const char* format, ...) { |
| 170 | va_list args; |
| 171 | |
| 172 | va_start(args, format); |
| 173 | gjs_throw_valist(cx, JSEXN_ERR, nullptr, format, args); |
| 174 | va_end(args); |
| 175 | } |
| 176 | |
| 177 | // COMPAT: Replace with a format string in C++20. |
| 178 | /* Like gjs_throw, but allows to customize the error class and 'name' property. |