Skip to content

Commit 995cbd9

Browse files
committed
fix: add try catch to catch symbol processing error
1 parent 90298ab commit 995cbd9

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

eslint.config.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ export default [
2525
parser: typescriptParser,
2626
parserOptions: {
2727
ecmaVersion: "latest",
28-
sourceType: "module",
29-
tsconfigRootDir: join(import.meta.dirname, "tsconfig.eslint.json")
28+
sourceType: "module"
3029
},
3130
globals: {
3231
...globals.node

packages/ts-doc/src/parsers/DocParser.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const {DocSymbolParser} = require("./DocSymbolParser");
44
const {sumBracket} = require("./sum-bracket");
55

66
const {stripsTags} = require("../utils/strips");
7+
const {logger} = require("../context/context");
78

89
const EXPORT_PATTERN = /^export /;
910

@@ -37,9 +38,13 @@ class DocParser {
3738
const {symbols} = new DocParser(docFile.contents).parse();
3839

3940
for (const [, symbol] of symbols) {
40-
await symbol.setDocFile(docFile);
41-
const newSymbol = context.symbols.push(symbol);
42-
docFile.symbols.set(newSymbol.symbolName, newSymbol);
41+
try {
42+
await symbol.setDocFile(docFile);
43+
const newSymbol = context.symbols.push(symbol);
44+
docFile.symbols.set(newSymbol.symbolName, newSymbol);
45+
} catch (er) {
46+
logger.error("Fail to process symbol", {symbol, error: er});
47+
}
4348
}
4449

4550
return docFile.symbols;

packages/ts-doc/src/scan/scan.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ module.exports = {
5353
context.logger("Scan folders '" + chalk.cyan(JSON.stringify(patterns)) + "'");
5454

5555
let symbolsSize = 0;
56-
const files = globby.sync(patterns);
56+
const files = await globby(patterns);
5757

5858
for (const file of files) {
5959
try {

0 commit comments

Comments
 (0)