Use the same error messages in the RPC code as the regular code

This commit is contained in:
Thomas Goyne 2017-09-15 13:16:42 -07:00
parent e697ae3d5c
commit 742ff99003
2 changed files with 4 additions and 4 deletions

View File

@ -83,14 +83,14 @@ export default class Realm {
if (typeof item == 'function') { if (typeof item == 'function') {
let schema = item.schema; let schema = item.schema;
if (!schema || typeof schema != 'object') { if (!schema || typeof schema != 'object') {
throw new Error("Realm object constructor must have 'schema' property"); throw new Error("Realm object constructor must have a 'schema' property.");
} }
let {name, properties} = schema; let {name, properties} = schema;
if (!name || typeof name != 'string') { if (!name || typeof name != 'string') {
throw new Error("Realm object schema must have 'name' property"); throw new Error(`Failed to read ObjectSchema: name must be of type 'string', got (${typeof name})`);
} else if (!properties || typeof properties != 'object') { } else if (!properties || typeof properties != 'object') {
throw new Error("Realm object schema must have 'properties' property"); throw new Error(`Failed to read ObjectSchema: properties must be of type 'object', got (${typeof properties})`);
} }
schemas.splice(i, 1, schema); schemas.splice(i, 1, schema);

View File

@ -85,5 +85,5 @@ export function typeForConstructor(realmId, constructor) {
} }
} }
return null; throw new Error("Constructor was not registered in the schema for this Realm")
} }