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:
parent
290fa43c43
commit
e6ba493bd3
1 changed files with 4 additions and 2 deletions
|
@ -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>
|
||||||
|
|
Loading…
Reference in a new issue