Skip to content

Commit

Permalink
fix(xqSuite.js): make XQTS error more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
duncdrum committed Apr 26, 2022
1 parent 27c1ed8 commit 4389fe5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions generators/app/templates/specs/xqs/xqSuite.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ http.get(url, (res) => {
// NOTE(DP): XQTS errors on testsuite, will be returned as application/xml
// The initial check will display the XQTS error, and run the test suite otherwise
// see #800
if (res.ContentType == "application/json") {
if (res.headers['content-type'].includes("application/json")) {
let xqsReport = JSON.parse(data)
let xqsPkg = xqsReport.testsuite.package
let xqstCount = xqsReport.testsuite.tests
Expand Down Expand Up @@ -55,8 +55,9 @@ http.get(url, (res) => {
})
}
else {
let doc = new xmldoc.XmlDocument(data)
throw new Error(doc.childNamed("message").val)
try { let doc = new xmldoc.XmlDocument(data)
throw new Error(doc.childNamed("message").val) }
catch (e) { console.log(e.message) }
}
})
}).on('error', (err) => {
Expand Down

0 comments on commit 4389fe5

Please sign in to comment.