Skip to content

Commit 861cf2d

Browse files
lrbarbershanedell
authored andcommitted
Output TDML errors via vscode pop-up
1 parent dfa4828 commit 861cf2d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/tdmlEditor/utilities/tdmlXmlUtils.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { readFileSync, writeFileSync } from 'fs'
1919
import os from 'os'
2020
import { join, resolve, sep, relative, dirname } from 'path'
2121
import { Element, ElementCompact, js2xml, xml2js } from 'xml-js'
22+
import * as vscode from 'vscode'
2223

2324
/*
2425
* Note that the functions in this file assumes the structure of a TDML file
@@ -290,10 +291,16 @@ export async function copyTestCase(
290291
)
291292

292293
if (sourceTestSuite === undefined) {
294+
vscode.window.showErrorMessage(
295+
'TDML ERROR: No test suite found in source XML buffer'
296+
)
293297
throw `No test suite found in source XML buffer`
294298
}
295299

296300
if (sourceTestSuite.length !== 1) {
301+
vscode.window.showErrorMessage(
302+
'TDML ERROR: More than one test suite found in source XML buffer'
303+
)
297304
throw `More than one test suite found in source XML buffer`
298305
}
299306

@@ -302,10 +309,16 @@ export async function copyTestCase(
302309
)
303310

304311
if (sourceTestCase === undefined) {
312+
vscode.window.showErrorMessage(
313+
'TDML ERROR: No test case found in source XML buffer'
314+
)
305315
throw `No test case found in source XML buffer`
306316
}
307317

308318
if (sourceTestCase.length !== 1) {
319+
vscode.window.showErrorMessage(
320+
'TDML ERROR: More than one test case found in source XML buffer'
321+
)
309322
throw `More than one test case found in source XML buffer`
310323
}
311324

@@ -379,10 +392,16 @@ export async function copyTestCase(
379392
)
380393

381394
if (destinationTestSuite === undefined) {
395+
vscode.window.showErrorMessage(
396+
'TDML ERROR: No test suites found in destination XML buffer'
397+
)
382398
throw `No test suites found in destination XML buffer`
383399
}
384400

385401
if (destinationTestSuite.length !== 1) {
402+
vscode.window.showErrorMessage(
403+
'TDML ERROR: More than one test suite found in destination XML buffer'
404+
)
386405
throw `More than one test suite found in destination XML buffer`
387406
}
388407

@@ -398,6 +417,9 @@ export async function copyTestCase(
398417
testCase.attributes[testCaseNameAttribute] ===
399418
sourceTestCase[0].attributes[testCaseNameAttribute]
400419
) {
420+
vscode.window.showErrorMessage(
421+
'TDML ERROR: Duplicate Test Case Name Found'
422+
)
401423
throw `Duplicate Test Case Name Found`
402424
}
403425
})

0 commit comments

Comments
 (0)