diff --git a/Userland/Libraries/LibWeb/HTML/Path2D.cpp b/Userland/Libraries/LibWeb/HTML/Path2D.cpp
index 696cd28bd7f..99ec7653e81 100644
--- a/Userland/Libraries/LibWeb/HTML/Path2D.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Path2D.cpp
@@ -12,9 +12,9 @@
namespace Web::HTML {
-JS::NonnullGCPtr Path2D::construct_impl(JS::Realm& realm, Optional, DeprecatedString>> const& path)
+WebIDL::ExceptionOr> Path2D::construct_impl(JS::Realm& realm, Optional, DeprecatedString>> const& path)
{
- return realm.heap().allocate(realm, realm, path).release_allocated_value_but_fixme_should_propagate_errors();
+ return MUST_OR_THROW_OOM(realm.heap().allocate(realm, realm, path));
}
// https://html.spec.whatwg.org/multipage/canvas.html#dom-path2d
diff --git a/Userland/Libraries/LibWeb/HTML/Path2D.h b/Userland/Libraries/LibWeb/HTML/Path2D.h
index 2805a60c8f1..81f7155c050 100644
--- a/Userland/Libraries/LibWeb/HTML/Path2D.h
+++ b/Userland/Libraries/LibWeb/HTML/Path2D.h
@@ -21,7 +21,7 @@ class Path2D final
WEB_PLATFORM_OBJECT(Path2D, Bindings::PlatformObject);
public:
- static JS::NonnullGCPtr construct_impl(JS::Realm&, Optional, DeprecatedString>> const& path);
+ static WebIDL::ExceptionOr> construct_impl(JS::Realm&, Optional, DeprecatedString>> const& path);
virtual ~Path2D() override;