diff --git a/src/uml/create-diagram.ts b/src/uml/create-diagram.ts index 94d0ff78..35631201 100644 --- a/src/uml/create-diagram.ts +++ b/src/uml/create-diagram.ts @@ -105,7 +105,7 @@ export async function createDiagramFromString( response = await request(url); const httpOK = 200; if (response.statusCode !== httpOK) { - Logger.error(`Plantuml Server responded with an error.\n${response.statusMessage}`); + await Logger.error(`Plantuml Server responded with an error.\n${response.statusMessage}`); throw new Error('Response not okay'); } } catch (e) { diff --git a/src/uml/read-definitions.ts b/src/uml/read-definitions.ts index 5714af35..d0dfffb1 100644 --- a/src/uml/read-definitions.ts +++ b/src/uml/read-definitions.ts @@ -93,7 +93,7 @@ export function readAsEnumDefinition( ); // get enum values according to type - if (declaration.kindString === 'Enumeration' && declaration.children) { + if (declaration.kindString === 'Enumeration' && typeof declaration.children !== 'undefined') { // standard enumeration for (const child of declaration.children) { if (child.kindString === 'Enumeration member') { @@ -154,7 +154,7 @@ function getTypeInformation(type: LightweightType): string[] { export function readAsClassDefinition( declaration: DeclarationReflection, ): LightweightClassDefinition { - let type = declaration.kindString ? declaration.kindString.toLowerCase() : ''; + let type = typeof declaration.kindString !== 'undefined' ? declaration.kindString.toLowerCase() : ''; type = (declaration.flags.isAbstract ? 'abstract ' : '') + type; const classDefinition: LightweightClassDefinition = new LightweightClassDefinition( @@ -314,7 +314,7 @@ function readAsReferenceType(type: ReferenceType): LightweightType { const tempTypeReflection = type.reflection as DeclarationReflection; // interfaces and classes in a type are a sink, since their declaration are defined elsewhere if ( - tempTypeReflection.kindString && + typeof tempTypeReflection.kindString !== 'undefined' && ['Interface', 'Class', 'Enumeration', 'Type alias'].indexOf( tempTypeReflection.kindString, ) > -1 @@ -383,7 +383,7 @@ function readAsUnionType(type: UnionType): LightweightType { */ function readAsReflectionType(type: ReflectionType): LightweightType { const returnType: LightweightType = new LightweightType(); - if (type.declaration.sources) { + if (typeof type.declaration.sources !== 'undefined') { const src = type.declaration.sources[0]; Logger.warn( `${src.line} : ${src.fileName}: Reflection Type not recognized. Refactoring to explicit class is advised.`,