From 742ff99003ee95c2c94a1471bee79d4038a9812e Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Fri, 15 Sep 2017 13:16:42 -0700 Subject: [PATCH] Use the same error messages in the RPC code as the regular code --- lib/browser/index.js | 6 +++--- lib/browser/objects.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) 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") }