Skip to content

Commit

Permalink
Merge pull request #10508 from quarto-dev/bugfix/issue-10504
Browse files Browse the repository at this point in the history
ignore range string error when attempting to detect a circular structure
  • Loading branch information
cscheid authored Aug 29, 2024
2 parents 9869f00 + 11868c4 commit 06f3f75
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/core/lib/yaml-intelligence/annotated-yaml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,24 @@ export function buildJsYamlAnnotation(mappedYaml: MappedString) {
);
}

JSON.stringify(results[0]); // this is here so that we throw on circular structures
// console.log(results[0]);
try {
JSON.stringify(results[0]); // this is here so that we throw on circular structures
} catch (e) {
if (e.message.match("invalid string length")) {
// https://github.com/quarto-dev/quarto-cli/issues/10504
// It seems to be relatively easy to hit string length limits in
// JSON.stringify. Since this call is only here to check for circular
// structures, we chose to ignore this error, even though it's not
// ideal
} else if (e.message.match(/circular structure/)) {
throw new InternalError(
`Circular structure detected in parsed yaml: ${e.message}`,
);
} else {

}
}
return postProcessAnnotation(results[0]);
}

Expand Down

0 comments on commit 06f3f75

Please sign in to comment.