diff --git a/lib/browser/index.js b/lib/browser/index.js index 10bc7512..8ef9fc12 100644 --- a/lib/browser/index.js +++ b/lib/browser/index.js @@ -83,14 +83,14 @@ export default class Realm { if (typeof item == 'function') { let schema = item.schema; 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; 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') { - 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); diff --git a/lib/browser/objects.js b/lib/browser/objects.js index f0f5caf7..9c9ad87e 100644 --- a/lib/browser/objects.js +++ b/lib/browser/objects.js @@ -85,5 +85,5 @@ export function typeForConstructor(realmId, constructor) { } } - return null; + throw new Error("Constructor was not registered in the schema for this Realm") }