Skip to content

Commit 803024f

Browse files
update error message handler (#131)
1 parent a0cb0ad commit 803024f

3 files changed

Lines changed: 70 additions & 37 deletions

File tree

package-lock.json

Lines changed: 31 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@fileverse-dev/dsheet",
33
"private": false,
44
"description": "DSheet",
5-
"version": "1.0.44",
5+
"version": "1.0.45",
66
"main": "dist/index.es.js",
77
"module": "dist/index.es.js",
88
"exports": {
@@ -34,10 +34,10 @@
3434
},
3535
"dependencies": {
3636
"@fileverse-dev/dsheets-templates": "^0.0.17",
37-
"@fileverse-dev/formula-parser": "^0.2.21",
38-
"@fileverse-dev/formulajs": "^4.4.11-mod-67",
39-
"@fileverse-dev/fortune-core": "^1.0.26",
40-
"@fileverse-dev/fortune-react": "^1.0.26",
37+
"@fileverse-dev/formula-parser": "^0.2.22",
38+
"@fileverse-dev/formulajs": "^4.4.11-mod-71",
39+
"@fileverse-dev/fortune-core": "^1.0.27",
40+
"@fileverse-dev/fortune-react": "^1.0.27",
4141
"@fileverse/ui": "^4.1.7-patch-18",
4242
"classnames": "^2.5.1",
4343
"exceljs": "^4.4.0",

package/types.ts

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,29 +71,55 @@ export interface DsheetProps {
7171
onDuneChartEmbed?: () => void;
7272
onSheetCountChange?: (sheetCount: number) => void;
7373
}
74-
type BaseError = {
74+
export type BaseError = {
7575
message: string;
7676
functionName?: string;
77-
type: string;
77+
type: `${ERROR_MESSAGES_FLAG}`;
7878
};
7979

80-
type CustomError = BaseError & {
80+
export type CustomError = BaseError & {
8181
type: typeof ERROR_MESSAGES_FLAG.CUSTOM;
8282
reason: string;
8383
};
8484

85+
export type InvalidParamError = BaseError & {
86+
type: typeof ERROR_MESSAGES_FLAG.INVALID_PARAM;
87+
};
88+
89+
export type MissingKeyError = BaseError & {
90+
type: typeof ERROR_MESSAGES_FLAG.MISSING_KEY;
91+
};
92+
93+
export type EnsResolveError = BaseError & {
94+
type: typeof ERROR_MESSAGES_FLAG.ENS;
95+
};
96+
97+
export type InvalidApiKeyError = BaseError & {
98+
type: typeof ERROR_MESSAGES_FLAG.INVALID_API_KEY;
99+
apiKeyName?: string;
100+
};
101+
102+
export type RateLimitError = BaseError & {
103+
type: typeof ERROR_MESSAGES_FLAG.RATE_LIMIT;
104+
apiKeyName?: string;
105+
};
106+
85107
export type NetworkError = BaseError & {
86-
type:
87-
| typeof ERROR_MESSAGES_FLAG.NETWORK_ERROR
88-
| typeof ERROR_MESSAGES_FLAG.RATE_LIMIT;
108+
type: typeof ERROR_MESSAGES_FLAG.NETWORK_ERROR;
109+
apiKeyName?: string;
89110
};
90111

91112
export type DefaultError = BaseError & {
113+
type: typeof ERROR_MESSAGES_FLAG.DEFAULT;
92114
reason: string;
93115
};
94116

95117
export type ErrorMessageHandlerReturnType =
96-
| BaseError
97-
| CustomError
118+
| InvalidParamError
119+
| MissingKeyError
120+
| RateLimitError
98121
| NetworkError
122+
| EnsResolveError
123+
| InvalidApiKeyError
124+
| CustomError
99125
| DefaultError;

0 commit comments

Comments
 (0)