Skip to content

Commit

Permalink
Merge pull request #42 from Informatievlaanderen/SDTT-266-Cannot-read…
Browse files Browse the repository at this point in the history
…-properties-of-null-reading-replace-at-removeCaret

Add error message for empty localName
  • Loading branch information
ddvlanck authored Feb 9, 2024
2 parents 9128d4f + 737bb3d commit 49192f4
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export class AttributeConverterHandler extends ConverterHandler<EaAttribute> {
const externalUri: string = getTagValue(attribute, TagNames.ExternalUri, null);
if (externalUri) {
uriRegistry.attributeIdUriMap.set(attribute.id, new URL(externalUri));
return;
}

let attributeBaseURI: string | undefined;
Expand Down Expand Up @@ -137,6 +138,10 @@ export class AttributeConverterHandler extends ConverterHandler<EaAttribute> {
TagNames.LocalName,
attribute.name,
);

if(!localName){
throw new Error(`[AttributeConverterHandler]: Unable to determine local name for attribute (${attribute.path}). If you used a "name" tag, did you set it correctly?`)
}
localName = toCamelCase(localName);

const attributeURI: URL = new URL(`${attributeBaseURI}${localName}`);
Expand Down

0 comments on commit 49192f4

Please sign in to comment.