LibJS: Repurpose MUST_OR_THROW_OOM to propagate general internal errors

There are now no users of the MUST_OR_THROW_OOM macro. Let's rename this
macro to indicate it may be used to propagate any internal error (such
as the call stack limit error) in places that would otherwise crash due
to a MUST/VERIFY invocation.

Note there's no actual functional change here, as we weren't able to
ensure the internal error was an OOM error previously.
This commit is contained in:
Timothy Flynn 2025-02-03 21:38:15 -05:00 committed by Tim Flynn
commit b91a0f5403
Notes: github-actions[bot] 2025-02-05 13:06:06 +00:00

View file

@ -31,7 +31,7 @@ namespace JS {
_temporary_result.release_value(); \
})
#define MUST_OR_THROW_OOM(...) \
#define MUST_OR_THROW_INTERNAL_ERROR(...) \
({ \
/* Ignore -Wshadow to allow nesting the macro. */ \
AK_IGNORE_DIAGNOSTIC("-Wshadow", \
@ -39,7 +39,6 @@ namespace JS {
if (_temporary_result.is_error()) { \
auto _completion = _temporary_result.release_error(); \
\
/* We can't explicitly check for OOM because InternalError does not store the ErrorType */ \
VERIFY(_completion.value().has_value()); \
VERIFY(_completion.value()->is_object()); \
VERIFY(::AK::is<JS::InternalError>(_completion.value()->as_object())); \