Skip to content

Commit

Permalink
perf: show more error
Browse files Browse the repository at this point in the history
  • Loading branch information
lisonge committed Jul 24, 2024
1 parent ac5a11e commit 5c27c98
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
],
"dependencies": {
"@antv/g6": "4.8.24",
"@gkd-kit/selector": "0.4.1",
"@gkd-kit/selector": "0.4.2",
"@gkd-kit/wasm_matches": "0.0.1",
"@rushstack/eslint-patch": "1.10.3",
"@tsconfig/node20": "20.1.4",
Expand Down
19 changes: 5 additions & 14 deletions pnpm-lock.yaml

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

20 changes: 17 additions & 3 deletions src/utils/selector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import {
UnknownIdentifierMethodException,
UnknownMemberException,
UnknownMemberMethodException,
UnknownIdentifierMethodParamsException,
UnknownMemberMethodParamsException,
Context,
MatchOption,
FastQuery,
Expand Down Expand Up @@ -192,17 +194,17 @@ const checkError = (s: Selector) => {
});
}
if (error instanceof UnknownIdentifierException) {
throw new Error('未知属性:' + error.value.value, {
throw new Error('未知属性:' + error.value.stringify(), {
cause: error,
});
}
if (error instanceof UnknownIdentifierMethodException) {
throw new Error('未知方法:' + error.value.value, {
throw new Error('未知方法:' + error.value.stringify(), {
cause: error,
});
}
if (error instanceof UnknownMemberException) {
throw new Error('未知属性:' + error.value.property, {
throw new Error('未知属性:' + error.value.stringify(), {
cause: error,
});
}
Expand All @@ -211,5 +213,17 @@ const checkError = (s: Selector) => {
cause: error,
});
}
if (error instanceof UnknownIdentifierMethodParamsException) {
throw new Error('未知方法参数:' + error.value.stringify(), {
cause: error,
});
}
if (error instanceof UnknownMemberMethodParamsException) {
throw new Error('未知方法参数:' + error.value.stringify(), {
cause: error,
});
}
// @ts-ignore
throw new Error('未知错误:' + error.message, { cause: error });
}
};

0 comments on commit 5c27c98

Please sign in to comment.