Skip to content

Commit

Permalink
Add logger to troubleshot on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrossetie committed Jul 8, 2023
1 parent ffab601 commit c855de9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/preprocess.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ function readPlantUmlInclude (url, resource, includePaths, includeStack, vfs, lo
logger.info(`Skipping preprocessing of PlantUML standard library include '${url}'`)
skip = true
} else if (includeStack.includes(url)) {
console.log({ includeStack, url })
const message = `Preprocessing of PlantUML include failed, because recursive reading already included referenced file '${url}'`
throw new Error(message)
} else {
Expand All @@ -243,6 +244,7 @@ function readPlantUmlInclude (url, resource, includePaths, includeStack, vfs, lo
} else {
filePath = resolveIncludeFile(url, resource, includePaths, vfs)
if (includeStack.includes(filePath)) {
console.log('after resolveIncludeFile', { includeStack, resource, includePaths, url })
const message = `Preprocessing of PlantUML include failed, because recursive reading already included referenced file '${filePath}'`
throw new Error(message)
} else {
Expand Down Expand Up @@ -342,6 +344,7 @@ function getPlantUmlTextOrFirstBlock (text) {
* @param {string[]} includeOnce
*/
function checkIncludeOnce (text, filePath, includeOnce) {
console.log('checkIncludeOnce', { filePath, includeOnce })
if (includeOnce.includes(filePath)) {
const message = `Preprocessing of PlantUML include failed, because including multiple times referenced file '${filePath}' with '!include_once' guard`
throw new Error(message)
Expand Down
4 changes: 2 additions & 2 deletions test/preprocess.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,11 @@ ${includedText}`
})

it('should throw an error for local file(s) referenced multiple times nested with "!include_once local-file-or-url"', () => {
const localExistingFileNameIncldudeOncePath = 'test/fixtures/plantuml/styles/style-include-once-general.iuml'
const localExistingFileNameIncludedOncePath = 'test/fixtures/plantuml/styles/style-include-once-general.iuml'
const diagramTextWithExistingLocalIncludeOneFile = `
!include_once ${localExistingFilePath}
alice -> bob
!include ${localExistingFileNameIncldudeOncePath}`
!include ${localExistingFileNameIncludedOncePath}`
const errorMessage = `Preprocessing of PlantUML include failed, because including multiple times referenced file '${localExistingFilePath}' with '!include_once' guard`
expect(() => preprocessPlantUML(diagramTextWithExistingLocalIncludeOneFile, {})).to.throw(errorMessage)
})
Expand Down

0 comments on commit c855de9

Please sign in to comment.