diff --git a/lib/connector.js b/lib/connector.js index 71055758..ccf2238e 100644 --- a/lib/connector.js +++ b/lib/connector.js @@ -158,7 +158,7 @@ Connector.getNestedPropertyDefinition = function(definition, propPath) { if (propPath.length === 1) return prop; if (isPropUndefined || (propPath.length > 1 && (isArray && prop.type.length === 0))) { - throw new Error(g.f('Invalid property path')); + return undefined; } const nextDefinition = diff --git a/test/connector.test.js b/test/connector.test.js index 7ffadeb7..08ac2f92 100644 --- a/test/connector.test.js +++ b/test/connector.test.js @@ -96,12 +96,11 @@ describe('Connector', () => { expect(propDefinition.type).to.equal(Date); }); - it('should fail for non-existing properties', () => { - expect(() => - connector.getPropertyDefinition( - 'MyModel', - 'non.existing.property' - )).to.throw(/Invalid property path/); + it('should return undefined for non-existing properties', () => { + const definition = connector.getPropertyDefinition('MyModel', + 'non.existing.property'); + // eslint-disable-next-line no-unused-expressions + expect(definition).to.be.undefined; }); it('should preserve backward-compatibility for non-existing property', () => {