Skip to content

Commit

Permalink
fix(web): prevent duplicate network error (#1177)
Browse files Browse the repository at this point in the history
* fix(web): prevent duplicate 'network error'

Signed-off-by: Jay Clark <jay@jayeclark.dev>

* fix(web): refactor errorTips

Signed-off-by: Jay Clark <jay@jayeclark.dev>

* fix(desktop): prevent duplicate error messages

Signed-off-by: Jay Clark <jay@jayeclark.dev>
  • Loading branch information
jayeclark committed Dec 7, 2021
1 parent 24fd1c7 commit e9be221
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions desktop/renderer-app/src/components/Tips/ErrorTips.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ export const errorTips = (e: unknown): void => {
}

if (e instanceof ServerRequestError) {
void message.error(i18n.t(e.errorMessage));
void message.error({
content: i18n.t(e.errorMessage),
key: e.errorMessage,
});
} else {
void message.error((e as Error).message);
const { message: content, message: key } = e as Error;
void message.error({ content, key });
}
};
8 changes: 6 additions & 2 deletions web/flat-web/src/components/Tips/ErrorTips.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ export const errorTips = (e: unknown): void => {
}

if (e instanceof ServerRequestError) {
void message.error(i18n.t(e.errorMessage));
void message.error({
content: i18n.t(e.errorMessage),
key: e.errorMessage,
});
} else {
void message.error((e as Error).message);
const { message: content, message: key } = e as Error;
void message.error({ content, key });
}
};

0 comments on commit e9be221

Please sign in to comment.