0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 16:22:35 +01:00

ircd::js: Improve script compilation exceptions.

This commit is contained in:
Jason Volk 2016-11-04 13:59:30 -07:00
parent 290fa43c43
commit e6ba493bd3

View file

@ -77,7 +77,7 @@ script<L>::script(const JS::ReadOnlyCompileOptions &opts,
:script<L>::root::type{} :script<L>::root::type{}
{ {
if(!JS::Compile(*cx, opts, src.data(), src.size(), &(*this))) if(!JS::Compile(*cx, opts, src.data(), src.size(), &(*this)))
throw syntax_error("Failed to compile script"); throw jserror(jserror::pending);
} }
template<lifetime L> template<lifetime L>
@ -86,7 +86,7 @@ script<L>::script(const JS::ReadOnlyCompileOptions &opts,
:script<L>::root::type{} :script<L>::root::type{}
{ {
if(!JS::Compile(*cx, opts, src.data(), src.size(), &(*this))) if(!JS::Compile(*cx, opts, src.data(), src.size(), &(*this)))
throw syntax_error("Failed to compile script"); throw jserror(jserror::pending);
} }
template<lifetime L> template<lifetime L>
@ -103,6 +103,8 @@ script<L>::script(yielding_t,
return JS::FinishOffThreadScript(*cx, *rt, token); return JS::FinishOffThreadScript(*cx, *rt, token);
}()} }()}
{ {
if(unlikely(!this->get()))
throw jserror(jserror::pending);
} }
template<lifetime L> template<lifetime L>