throw std::logic_error instead of aborting the process and convert to java exception

Summary: Changelog: [Internal][Yoga] throw std::logic_error instead of aborting the process and convert to java exception for jni layer

Reviewed By: pasqualeanatriello

Differential Revision: D21301235

fbshipit-source-id: 148b27920e62990a271e1d0df8c85a2cc42f4fd4
This commit is contained in:
Sidharth Guglani
2020-05-14 06:32:13 -07:00
committed by Facebook GitHub Bot
parent ac7c85c0a6
commit 07c0d539bd
6 changed files with 18 additions and 9 deletions

View File

@@ -580,7 +580,7 @@ TEST(YogaDeathTest, cannot_add_child_to_node_with_measure_func) {
root->setMeasureFunc(_measure);
const YGNodeRef root_child0 = YGNodeNew();
ASSERT_DEATH(YGNodeInsertChild(root, root_child0, 0), "Cannot add child.*");
ASSERT_THROW(YGNodeInsertChild(root, root_child0, 0), std::logic_error);
YGNodeFree(root_child0);
YGNodeFreeRecursive(root);
}
@@ -589,7 +589,7 @@ TEST(YogaDeathTest, cannot_add_nonnull_measure_func_to_non_leaf_node) {
const YGNodeRef root = YGNodeNew();
const YGNodeRef root_child0 = YGNodeNew();
YGNodeInsertChild(root, root_child0, 0);
ASSERT_DEATH(root->setMeasureFunc(_measure), "Cannot set measure function.*");
ASSERT_THROW(root->setMeasureFunc(_measure), std::logic_error);
YGNodeFreeRecursive(root);
}