Skip to content

Commit

Permalink
Fix throw on not found property
Browse files Browse the repository at this point in the history
  • Loading branch information
jedelbo committed Jun 20, 2024
1 parent 9ab20d9 commit 4fa4284
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/realm/obj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -700,9 +700,7 @@ Mixed Obj::get_additional_prop(StringData prop_name) const
return *val;
}
}
else {
throw InvalidArgument(ErrorCodes::InvalidProperty, util::format("Property not found: %1", prop_name));
}
throw InvalidArgument(ErrorCodes::InvalidProperty, util::format("Property not found: %1", prop_name));
return {};
}

Expand Down
1 change: 1 addition & 0 deletions test/test_sync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6252,6 +6252,7 @@ TEST(Sync_AdditionalProperties)
CHECK_EQUAL(obj.get_any("any"), Mixed("FooBar"));
auto list = obj.get_list_ptr<Mixed>({"scores"});
CHECK_EQUAL(list->get(0), Mixed(4.6));
CHECK_THROW_ANY(obj.get_any("some"));
CHECK_THROW_ANY(obj.erase_prop("any"));
obj.erase_prop("age");
});
Expand Down

0 comments on commit 4fa4284

Please sign in to comment.