Add Schema Name to Error Message with Primary Key (#1655)

* specifying schema name in error
This commit is contained in:
Maximilian Alexander 2018-02-06 23:25:54 -08:00 committed by Kenneth Geisshirt
parent 818fe6ef9c
commit 96370f3240
2 changed files with 2 additions and 1 deletions

View File

@ -5,6 +5,7 @@
### Enhancements ### Enhancements
* [Object Server] Wait for pending notifications to complete when removing a sync listener (#1648). * [Object Server] Wait for pending notifications to complete when removing a sync listener (#1648).
* Add schema name to missing primary key error message
### Bug fixes ### Bug fixes
* [Object Server] Fixed a bug causing use-after-free crashes in Global Notifier (realm-js-private #405). * [Object Server] Fixed a bug causing use-after-free crashes in Global Notifier (realm-js-private #405).

View File

@ -247,7 +247,7 @@ ObjectSchema Schema<T>::parse_object_schema(ContextType ctx, ObjectType object_s
object_schema.primary_key = Value::validated_to_string(ctx, primary_value); object_schema.primary_key = Value::validated_to_string(ctx, primary_value);
Property *property = object_schema.primary_key_property(); Property *property = object_schema.primary_key_property();
if (!property) { if (!property) {
throw std::runtime_error("Missing primary key property '" + object_schema.primary_key + "'"); throw std::runtime_error("Schema named '" + object_schema.name + "' specifies primary key of '" + object_schema.primary_key + "' but does not declare a property of that name.");
} }
property->is_primary = true; property->is_primary = true;
} }