Skip to content

Commit

Permalink
fix: avoid unnecessary exceptions in object preview evaluation (micro…
Browse files Browse the repository at this point in the history
…soft#1905)

* fix: avoid unnecessary exceptions in object preview evaluation

Fixes microsoft#1904

* update test-electron for unit test failures
  • Loading branch information
connor4312 authored Dec 13, 2023
1 parent 6988eed commit 4d305bc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
"@typescript-eslint/eslint-plugin": "^6.9.1",
"@typescript-eslint/parser": "^6.9.1",
"@vscode/dwarf-debugging": "^0.0.2",
"@vscode/test-electron": "^2.3.4",
"@vscode/test-electron": "^2.3.8",
"chai": "^4.3.6",
"chai-as-promised": "^7.1.1",
"chai-string": "^1.5.0",
Expand Down
6 changes: 6 additions & 0 deletions src/adapter/templates/getStringyProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ export const getStringyProps = templateFunction(function (
if (typeof value === 'object' && value) {
let str: string | undefined;
for (const sym of runtimeArgs[0]) {
if (typeof value[sym] !== 'function') {
continue;
}
try {
str = value[sym]();
break;
Expand Down Expand Up @@ -98,6 +101,9 @@ export const getToStringIfCustom = templateFunction(function (
Symbol.for(DescriptionSymbols.Generic),
Symbol.for(DescriptionSymbols.Node),
]) {
if (typeof (this as Record<symbol, () => string>)[sym] !== 'function') {
continue;
}
try {
str = (this as Record<symbol, () => string>)[sym]();
break;
Expand Down

0 comments on commit 4d305bc

Please sign in to comment.