Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
Match any exception type for Tensor indexing API (#118)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #118

The tensor indexing API relies on exceptions when a prop name cannot be converted to an int via `std::stoi`.

After upgrading to Expo 46, it causes a runtime error (`std::exception&`), which doesn't get caught with the current `catch`. The change broadens the `catch` to match any exception (`catch (...)`), which fixes the issue.

The reasons are not clear, but it's assumed to be a compiler flag change. We continue to investigate, but in the meantime, this change unblock anyone who is facing the same issue

Reviewed By: justinhaaheim

Differential Revision: D39148492

fbshipit-source-id: f52331671e57ce9957befa3717c43b6f7b7de76c
  • Loading branch information
raedle authored and facebook-github-bot committed Sep 7, 2022
1 parent 38602f4 commit 877157c
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ jsi::Value TensorHostObject::get(
int idx = -1;
try {
idx = std::stoi(name.c_str());
} catch (const std::exception& e) {
} catch (...) {
// Cannot parse name value to int. This can happen when the name in bracket
// or dot notion is not an int (e.g., tensor['foo']).
// Let's ignore this exception here since this function will return
Expand Down

0 comments on commit 877157c

Please sign in to comment.