From 96370f3240ffa7e2e948641ed439ca09f66ad4f1 Mon Sep 17 00:00:00 2001 From: Maximilian Alexander Date: Tue, 6 Feb 2018 23:25:54 -0800 Subject: [PATCH] Add Schema Name to Error Message with Primary Key (#1655) * specifying schema name in error --- CHANGELOG.md | 1 + src/js_schema.hpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 459d1486..9cfd2d85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Enhancements * [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 * [Object Server] Fixed a bug causing use-after-free crashes in Global Notifier (realm-js-private #405). diff --git a/src/js_schema.hpp b/src/js_schema.hpp index 3a5cf3d2..17fe3ddb 100644 --- a/src/js_schema.hpp +++ b/src/js_schema.hpp @@ -247,7 +247,7 @@ ObjectSchema Schema::parse_object_schema(ContextType ctx, ObjectType object_s object_schema.primary_key = Value::validated_to_string(ctx, primary_value); Property *property = object_schema.primary_key_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; }