diff --git a/lib/preprocess/parameterproperty/ParameterPropertyHandlerRange.ts b/lib/preprocess/parameterproperty/ParameterPropertyHandlerRange.ts index bca5a12..570755b 100644 --- a/lib/preprocess/parameterproperty/ParameterPropertyHandlerRange.ts +++ b/lib/preprocess/parameterproperty/ParameterPropertyHandlerRange.ts @@ -480,7 +480,8 @@ export class ParameterPropertyHandlerRange implements IParameterPropertyHandler const withTypes = value && value.properties.types.length > 0 ? ` with types "${value.properties.types.map(resource => resource.value)}"` : ''; // eslint-disable-next-line @typescript-eslint/no-extra-parens const valueString = value ? (value.list ? `[${value.list.map(subValue => subValue.value).join(', ')}]` : value.value) : 'undefined'; - throw new ErrorResourcesContext(`The value "${valueString}"${withTypes} for parameter "${parameter.value}" is not of required range type "${ParameterPropertyHandlerRange.rangeToDisplayString(parameter.property.range, genericsContext)}"`, { + const undefinedComponent = value && value.term.termType === 'NamedNode' && value.properties.types.length === 0 ? `. "${valueString}" seems to refer to a component instance that is not defined yet. Did you forget an import?` : ''; + throw new ErrorResourcesContext(`The value "${valueString}"${withTypes} for parameter "${parameter.value}" is not of required range type "${ParameterPropertyHandlerRange.rangeToDisplayString(parameter.property.range, genericsContext)}"${undefinedComponent}`, { cause: conflict, value: value || 'undefined', ...Object.keys(genericsContext.bindings).length > 0 ? diff --git a/test/unit/preprocess/parameterproperty/ParameterPropertyHandlerRange-test.ts b/test/unit/preprocess/parameterproperty/ParameterPropertyHandlerRange-test.ts index fb69be2..5fb11ab 100644 --- a/test/unit/preprocess/parameterproperty/ParameterPropertyHandlerRange-test.ts +++ b/test/unit/preprocess/parameterproperty/ParameterPropertyHandlerRange-test.ts @@ -2790,7 +2790,7 @@ describe('ParameterPropertyHandlerRange', () => { objectLoader.createCompactedResource('ex:param'), genericsContext, conflict, - )).toThrow('The value "ex:value" for parameter "ex:param" is not of required range type "any"'); + )).toThrow(`The value "ex:value" for parameter "ex:param" is not of required range type "any". "ex:value" seems to refer to a component instance that is not defined yet. Did you forget an import?`); }); it('handles a defined value with types', () => {