From 737bb3dc5e311ce092e4f21809eb724c7c849cd3 Mon Sep 17 00:00:00 2001 From: Dwight Van Lancker Date: Thu, 8 Feb 2024 16:23:59 +0100 Subject: [PATCH] Add error message for empty localName --- .../lib/converter-handlers/AttributeConverterHandler.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/oslo-converter-uml-ea/lib/converter-handlers/AttributeConverterHandler.ts b/packages/oslo-converter-uml-ea/lib/converter-handlers/AttributeConverterHandler.ts index 716bcbb..d6d5c68 100644 --- a/packages/oslo-converter-uml-ea/lib/converter-handlers/AttributeConverterHandler.ts +++ b/packages/oslo-converter-uml-ea/lib/converter-handlers/AttributeConverterHandler.ts @@ -84,6 +84,7 @@ export class AttributeConverterHandler extends ConverterHandler { const externalUri: string = getTagValue(attribute, TagNames.ExternalUri, null); if (externalUri) { uriRegistry.attributeIdUriMap.set(attribute.id, new URL(externalUri)); + return; } let attributeBaseURI: string | undefined; @@ -137,6 +138,10 @@ export class AttributeConverterHandler extends ConverterHandler { 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}`);