Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

Commit 91e7bcb

Browse files
committed
fix: fix errorCenter
1 parent 8d5d947 commit 91e7bcb

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

packages/ui/xconsole-error-center/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@alicloud/xconsole-error-center",
3-
"version": "2.3.48",
3+
"version": "2.3.49",
44
"main": "lib/index.js",
55
"module": "es/index.js",
66
"license": "MIT",

packages/ui/xconsole-error-center/src/errorPrompt/ErrorPrompt.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ const showError = (option: ShowErrorOption) => {
7676

7777
const errorConfig = getErrorConfig(option.errorConfig, error, getMessage);
7878

79-
const code = error?.response?.data?.code;
79+
// error maybe:
80+
// { code: 'xxx', message: 'xxx' }
81+
// { response: { ... } }
82+
const code = error?.response?.data?.code || (error as unknown as { code: string })?.code;
8083

8184
const errorPromptConfig = {
8285
locale: LOCALE,

packages/ui/xconsole-error-center/src/errorPrompt2/ErrorPrompt2.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const processError = (errorConfig: Partial<ErrorCodeConfig>, error: ResponseErro
6666

6767
const errorPrompt2 = (option: ShowErrorOption) => {
6868
const { error, getMessage } = option;
69-
const code = error?.response?.data?.code;
69+
const code = error?.response?.data?.code || (error as unknown as { code: string }).code ;
7070
const errorConfig = getErrorConfig(option.errorConfig, error, getMessage);
7171

7272
if(process.env.NODE_ENV === 'development' && (errorConfig.cancelLabel || errorConfig.cancelHref)) {

0 commit comments

Comments
 (0)