Use the same error messages in the RPC code as the regular code
This commit is contained in:
parent
e697ae3d5c
commit
742ff99003
|
@ -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);
|
||||
|
|
|
@ -85,5 +85,5 @@ export function typeForConstructor(realmId, constructor) {
|
|||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
throw new Error("Constructor was not registered in the schema for this Realm")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue