Skip to content

Commit 8708a07

Browse files
committed
Correct error types
1 parent b2bca61 commit 8708a07

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

server/src/analyser.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ export default class Analyzer {
5959
try {
6060
filePaths = await getFilePaths({ globPattern, rootPath })
6161
} catch (error) {
62+
const errorMessage = error instanceof Error ? error.message : error
6263
connection.window.showWarningMessage(
63-
`Failed to analyze bash files using the glob "${globPattern}". The experience will be degraded. Error: ${error.message}`,
64+
`Failed to analyze bash files using the glob "${globPattern}". The experience will be degraded. Error: ${errorMessage}`,
6465
)
6566
}
6667

@@ -84,7 +85,8 @@ export default class Analyzer {
8485

8586
analyzer.analyze(uri, LSP.TextDocument.create(uri, 'shell', 1, fileContent))
8687
} catch (error) {
87-
connection.console.warn(`Failed analyzing ${uri}. Error: ${error.message}`)
88+
const errorMessage = error instanceof Error ? error.message : error
89+
connection.console.warn(`Failed analyzing ${uri}. Error: ${errorMessage}`)
8890
}
8991
}
9092

server/src/server.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,9 @@ export default class BashServer {
248248
}
249249
}
250250
} catch (error) {
251+
const errorMessage = error instanceof Error ? error.message : error
251252
this.connection.console.warn(
252-
`getExplainshellDocumentation exception: ${error.message}`,
253+
`getExplainshellDocumentation exception: ${errorMessage}`,
253254
)
254255
}
255256
}

0 commit comments

Comments
 (0)