Skip to content

Commit ef6ab3f

Browse files
neildharfacebook-github-bot
authored andcommitted
Throw JSINativeException from asHostObject
Summary: `asHostObject` should throw a `JSINativeException` like the other `as*` functions. This should be a safe change to make in most cases, since this function already did not work when JSI was being provided by a dynamic library. However, I defer to mhorowitz. Changelog: [Fixed] Throw JSINativeException from asHostObject Reviewed By: jpporto Differential Revision: D36873355 fbshipit-source-id: 589ac50ebb4ecec4bacfd923d8b0795c0a6c0e34
1 parent 66c6a75 commit ef6ab3f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ReactCommon/jsi/jsi/jsi-inl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ inline std::shared_ptr<T> Object::getHostObject(Runtime& runtime) const {
189189
template <typename T>
190190
inline std::shared_ptr<T> Object::asHostObject(Runtime& runtime) const {
191191
if (!isHostObject<T>(runtime)) {
192-
detail::throwOrDie<JSError>(
193-
runtime, "Object is not a HostObject of desired type");
192+
detail::throwOrDie<JSINativeException>(
193+
"Object is not a HostObject of desired type");
194194
}
195195
return std::static_pointer_cast<T>(runtime.getHostObject(*this));
196196
}

0 commit comments

Comments
 (0)