diff --git a/server/packages/server-common/src/providers/validation/rules/StepErrorValidationRule.ts b/server/packages/server-common/src/providers/validation/rules/StepErrorValidationRule.ts index 96cfe58..2ef82ec 100644 --- a/server/packages/server-common/src/providers/validation/rules/StepErrorValidationRule.ts +++ b/server/packages/server-common/src/providers/validation/rules/StepErrorValidationRule.ts @@ -10,19 +10,21 @@ export class StepExportErrorValidationRule implements ValidationRule { public async validate(documentContext: DocumentContext): Promise { const diagnostics: Diagnostic[] = []; const steps = documentContext.nodeManager.getStepNodes(true); - steps.forEach((step) => { + for (const step of steps) { const errors = step.properties.find((p) => p.keyNode.value === "errors"); - if (errors) { + if (errors && errors.valueNode && errors.valueNode.type !== "null") { const range = documentContext.nodeManager.getNodeRange(errors); + const valueRange = documentContext.nodeManager.getNodeRange(errors.valueNode); + const errorValue = documentContext.textDocument.getText(valueRange); diagnostics.push( Diagnostic.create( range, - `Tool step contains error indicated during Galaxy export - ${errors}`, - DiagnosticSeverity.Warning + `Tool step contains error indicated during Galaxy export - ${errorValue}`, + this.severity ) ); } - }); + } return Promise.resolve(diagnostics); } }